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

Re: [libvirt] [PATCH] virsh: Plug memory leak on cmdDesc



On 2012年02月08日 14:00, ajia redhat com wrote:
From: Alex Jia<ajia redhat com>

Forgot to free the domain object, this will intruduce resource leaks including
memory leak and FD leaks.

* tools/virsh.c(cmdDesc): fix memory leak.

* How to reproduce?
% virsh desc<domain>
No description for domain:<domain>
error: Failed to disconnect from the hypervisor, 1 leaked reference(s)

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

diff --git a/tools/virsh.c b/tools/virsh.c
index bff7d5d..c107d8c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1167,6 +1167,8 @@ cleanup:
          unlink(tmp);
          VIR_FREE(tmp);
      }
+    if (dom)
+        virDomainFree(dom);
      return ret;
  }


ACK


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