[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 03/13] netdev_vlan_conf: Resolve memory leak found by Valgrind.



On 2013年02月07日 05:35, John Ferlan wrote:
The 'trunk' is filled in with virXPathString() value, but was
never VIR_FREE()'d.
---
  src/conf/netdev_vlan_conf.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c
index 9207184..13ba8c6 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;

ACK


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]