]> xenbits.xensource.com Git - libvirt.git/commitdiff
virConfGetValue: Fixed NULL pointer check
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 19 Mar 2012 10:05:30 +0000 (11:05 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 19 Mar 2012 10:42:24 +0000 (11:42 +0100)
This patch fixes a NULL pointer check that was causing SegFault on
some specific configurations. It also reverts commit 59d0c9801c1ab
that was checking for this value in one place.

src/libvirt.c
src/util/conf.c

index 7f8d42c797e6f203b2bf242601f3f5fba8851e7e..99b263efc1b7e656631f923a254ab5b7b673f97e 100644 (file)
@@ -1085,8 +1085,7 @@ virConnectOpenResolveURIAlias(virConfPtr conf,
 
     *uri = NULL;
 
-    if (conf &&
-        (value = virConfGetValue(conf, "uri_aliases")))
+    if ((value = virConfGetValue(conf, "uri_aliases")))
         ret = virConnectOpenFindURIAliasMatch(value, alias, uri);
     else
         ret = 0;
index 8ad60e02c8e850f6c1624fa0578a02c393cb0812..33703372910bfd7dcef201fcc83fd1f9086cf260 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * conf.c: parser for a subset of the Python encoded Xen configuration files
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting)
 {
     virConfEntryPtr cur;
 
+    if (conf == NULL)
+        return NULL;
+
     cur = conf->entries;
     while (cur != NULL) {
         if ((cur->name != NULL) &&