[libvirt] [PATCH] virsh: fix memory leak in cmdNetworkInfo

ajia at redhat.com ajia at redhat.com
Tue Aug 2 08:31:36 UTC 2011


I have ever discussed this issue with Matthias, and he has fixed this leak in
cmdNetworkInfo codes, but he hasn't committed a patch to upstream so that 
bug 722806 is always assigned status, so commit it to avoid this patch missing. 

* tools/virsh.c: avoid memory leak in cmdNetworkInfo.

* how to reproduce?
  % valgrind -v --leak-check=yes virsh net-info default

  https://bugzilla.redhat.com/show_bug.cgi?id=722806

Signed-off-by: Alex Jia <ajia at redhat.com>
---
 tools/virsh.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 23e71d7..cf8e2a5 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -5597,6 +5597,7 @@ cmdNetworkInfo(vshControl *ctl, const vshCmd *cmd)
     if (bridge)
         vshPrint(ctl, "%-15s %s\n", _("Bridge:"), bridge);
 
+    VIR_FREE(bridge);
     virNetworkFree(network);
     return true;
 }
-- 
1.7.1




More information about the libvir-list mailing list