]> xenbits.xensource.com Git - libvirt.git/commitdiff
lib: Don't access configuration if none is present
authorPeter Krempa <pkrempa@redhat.com>
Thu, 15 Mar 2012 16:10:22 +0000 (17:10 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 15 Mar 2012 16:41:36 +0000 (17:41 +0100)
Commit e457d5ef2015e6106094b85f8bbd1582002edc4d adds ability to pass the
default URI using the client configuration file. If the file is not
present, it still accesses the NULL config object causing a segfault.

Caught running "make check".

src/libvirt.c

index 1c0cdf7c6390860cf20ca930a25c02a4e89c31d7..d0b1b28d4434afccbd4c1f5145d84d819c4f29d0 100644 (file)
@@ -1085,7 +1085,8 @@ virConnectOpenResolveURIAlias(virConfPtr conf,
 
     *uri = NULL;
 
-    if ((value = virConfGetValue(conf, "uri_aliases")))
+    if (conf &&
+        (value = virConfGetValue(conf, "uri_aliases")))
         ret = virConnectOpenFindURIAliasMatch(value, alias, uri);
     else
         ret = 0;