From 9951acfdcb794b4ab2af9e6f494e09cdf74f6c68 Mon Sep 17 00:00:00 2001 Message-Id: <9951acfdcb794b4ab2af9e6f494e09cdf74f6c68@dist-git> From: Erik Skultety Date: Thu, 18 Sep 2014 15:16:09 +0200 Subject: [PATCH] Fix libvirtd crash when removing metadata 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 --- src/util/virxml.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virxml.c b/src/util/virxml.c index cc4a85c..9ce705a 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -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)) -- 2.1.1