]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix libvirtd crash when removing metadata
authorErik Skultety <eskultet@redhat.com>
Thu, 18 Sep 2014 12:25:05 +0000 (14:25 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 18 Sep 2014 12:46:40 +0000 (14:46 +0200)
When trying to remove nonexistent metadata from XML, libvirt daemon
crashes due to dereferencing NULL pointer.

Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1143955

src/util/virxml.c

index a91da050a34a8acc79115654754f38fc91a48b3d..27ecf14a249f435a3428d20059783804c0eef560 100644 (file)
@@ -974,6 +974,9 @@ virXMLFindChildNodeByNs(xmlNodePtr root,
 {
     xmlNodePtr next;
 
+    if (!root)
+        return NULL;
+
     for (next = root->children; next; next = next->next) {
         if (next->ns &&
             STREQ_NULLABLE((const char *) next->ns->href, uri))