
2010/2/15 Jim Meyering <jim@meyering.net>:
It looks like there may still be error-path leaks (the buffers pointed to by nodes[i]), but that can wait for another day.
No, the xmlNodePtr in the nodes array are owned by the XML document object and are freed when the xmlDocPtr gets freed.
From c293a97ed55c99c87bc658aaffc10831f8ba8c68 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Mon, 15 Feb 2010 19:54:45 +0100 Subject: [PATCH] virNodeDevCapScsiHostParseXML: avoid an unconditional leak
* src/conf/node_device_conf.c (virNodeDevCapScsiHostParseXML): Free the "nodes" buffer allocated by virXPathNodeSet. --- src/conf/node_device_conf.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 4b65953..09c0f41 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -797,6 +797,7 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt, out: VIR_FREE(type); ctxt->node = orignode; + VIR_FREE(nodes); return ret; }
-- 1.7.0.181.g41533
Yes, the nodes array is allocated by virXPathNodeSet to return the list of xmlNodePtrs and needs to be freed here. ACK. Matthias