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

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

 



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

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@xxxxxxxxxx>
---
  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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]