From 04e1195be4e5e52da19050e2fadae95e9525ef3b Mon Sep 17 00:00:00 2001
Message-Id: <04e1195be4e5e52da19050e2fadae95e9525ef3b@dist-git>
From: Erik Skultety <eskultet@redhat.com>
Date: Thu, 22 Jan 2015 16:25:16 +0100
Subject: [PATCH] Fix libvirtd crash when removing metadata
https://bugzilla.redhat.com/show_bug.cgi?id=1184929
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
(cherry picked from commit 288c47406cffa7a6eb9e9c29764850b0cdeb5508)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/util/virxml.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 88c1fcc..6cee8e1 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -979,6 +979,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))
--
2.2.1