From: John Ferlan Date: Tue, 10 Mar 2015 22:24:49 +0000 (-0400) Subject: conf: Resolve Coverity RESOURCE_LEAK X-Git-Tag: v1.2.14-rc1~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9beeb68e4d21ff98787dee78e6b1e7368bf88b0;p=thirdparty%2Flibvirt.git conf: Resolve Coverity RESOURCE_LEAK Commit id 'c9027d8f' added parsing of the CapNet for offload SRIOV NIC discovery, but forgot to free the nodes --- diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index f9c9b6fa7a..07cc0d02fd 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -939,7 +939,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, xmlNodePtr orignode, lnk; size_t i = -1; int ret = -1, n = -1; - char *tmp; + char *tmp = NULL; xmlNodePtr *nodes = NULL; orignode = ctxt->node; @@ -978,6 +978,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, goto out; } ignore_value(virBitmapSetBit(data->net.features, val)); + VIR_FREE(tmp); } data->net.subtype = VIR_NODE_DEV_CAP_NET_LAST; @@ -1002,6 +1003,8 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, ret = 0; out: ctxt->node = orignode; + VIR_FREE(nodes); + VIR_FREE(tmp); return ret; }