]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Fix a problem which will cause libvirtd crashed
authorOsier Yang <jyang@redhat.com>
Wed, 16 Mar 2011 08:28:07 +0000 (16:28 +0800)
committerOsier Yang <jyang@redhat.com>
Wed, 16 Mar 2011 08:28:07 +0000 (16:28 +0800)
If pool xml has no definition for "port", then "Segmentation fault"
happens when jumping to "cleanup:" to do "VIR_FREE(port)", as "port"
was not initialized in this situation.

* src/conf/storage_conf.c

src/conf/storage_conf.c

index 6e3fe0e197b6d3daed4e238da5cd5b9a44f1d2b4..13a36229fe57382b0ebd5c55281d6762452153de 100644 (file)
@@ -396,7 +396,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
     char *authType = NULL;
     int nsource, i;
     virStoragePoolOptionsPtr options;
-    char *port;
+    char *port = NULL;
 
     relnode = ctxt->node;
     ctxt->node = node;