From: John Ferlan Date: Mon, 4 Feb 2013 14:57:00 +0000 (-0500) Subject: netdev_vlan_conf: Resolve memory leak found by Valgrind. X-Git-Tag: v1.0.3-rc1~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba9c7a3026d11dfb3afdc393da754ec3a4804be2;p=thirdparty%2Flibvirt.git netdev_vlan_conf: Resolve memory leak found by Valgrind. The 'trunk' is filled in with virXPathString() value, but was never VIR_FREE()'d. --- diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c index 9207184fc1..13ba8c6ab8 100644 --- a/src/conf/netdev_vlan_conf.c +++ b/src/conf/netdev_vlan_conf.c @@ -32,7 +32,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de { int ret = -1; xmlNodePtr save = ctxt->node; - const char *trunk; + const char *trunk = NULL; xmlNodePtr *tagNodes = NULL; int nTags, ii; @@ -103,6 +103,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de error: ctxt->node = save; VIR_FREE(tagNodes); + VIR_FREE(trunk); if (ret < 0) virNetDevVlanClear(def); return ret;