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