]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
netdev_vlan_conf: Resolve memory leak found by Valgrind.
authorJohn Ferlan <jferlan@redhat.com>
Mon, 4 Feb 2013 14:57:00 +0000 (09:57 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 7 Feb 2013 19:08:14 +0000 (14:08 -0500)
The 'trunk' is filled in with virXPathString() value, but was
never VIR_FREE()'d.

src/conf/netdev_vlan_conf.c

index 9207184fc17b8b90b6817454390b1d94835054a4..13ba8c6ab84404cc3762731a608b7fcb56e9c43f 100644 (file)
@@ -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;