lib: Fix use-after-free bug in XPath parsing code.
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 28 Jan 2011 17:11:40 +0000 (17:11 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 28 Jan 2011 18:57:34 +0000 (18:57 +0000)
src/virt.c

index 2c6be3c..9f84908 100644 (file)
@@ -196,8 +196,8 @@ guestfs___for_each_disk (guestfs_h *g,
     assert (xptype->nodesetval->nodeTab[0]);
     assert (xptype->nodesetval->nodeTab[0]->type == XML_ATTRIBUTE_NODE);
     xmlAttrPtr attr = (xmlAttrPtr) xptype->nodesetval->nodeTab[0];
-    xmlXPathFreeObject (xptype);
     char *type = (char *) xmlNodeListGetString (doc, attr->children, 1);
+    xmlXPathFreeObject (xptype);
 
     xmlXPathObjectPtr xpfilename;