render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
898951
From 04e1195be4e5e52da19050e2fadae95e9525ef3b Mon Sep 17 00:00:00 2001
898951
Message-Id: <04e1195be4e5e52da19050e2fadae95e9525ef3b@dist-git>
898951
From: Erik Skultety <eskultet@redhat.com>
898951
Date: Thu, 22 Jan 2015 16:25:16 +0100
898951
Subject: [PATCH] Fix libvirtd crash when removing metadata
898951
898951
https://bugzilla.redhat.com/show_bug.cgi?id=1184929
898951
898951
When trying to remove nonexistent metadata from XML, libvirt daemon
898951
crashes due to dereferencing NULL pointer.
898951
898951
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1143955
898951
898951
(cherry picked from commit 288c47406cffa7a6eb9e9c29764850b0cdeb5508)
898951
898951
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
898951
---
898951
 src/util/virxml.c | 3 +++
898951
 1 file changed, 3 insertions(+)
898951
898951
diff --git a/src/util/virxml.c b/src/util/virxml.c
898951
index 88c1fcc..6cee8e1 100644
898951
--- a/src/util/virxml.c
898951
+++ b/src/util/virxml.c
898951
@@ -979,6 +979,9 @@ virXMLFindChildNodeByNs(xmlNodePtr root,
898951
 {
898951
     xmlNodePtr next;
898951
 
898951
+    if (!root)
898951
+        return NULL;
898951
+
898951
     for (next = root->children; next; next = next->next) {
898951
         if (next->ns &&
898951
             STREQ_NULLABLE((const char *) next->ns->href, uri))
898951
-- 
898951
2.2.1
898951