[PATCH] Fix libvirtd crash when removing metadata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/util/virxml.c b/src/util/virxml.c
index a91da05..f386956 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -972,7 +972,9 @@ xmlNodePtr
 virXMLFindChildNodeByNs(xmlNodePtr root,
                         const char *uri)
 {
-    xmlNodePtr next;
+    xmlNodePtr next = NULL;
+    if (!root)
+        goto cleanup;
 
     for (next = root->children; next; next = next->next) {
         if (next->ns &&
@@ -980,6 +982,7 @@ virXMLFindChildNodeByNs(xmlNodePtr root,
             return next;
     }
 
+ cleanup:
     return NULL;
 }
 
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]