[libvirt] [PATCH] Fix a virsh edit memory leak

Chris Lalancette clalance at redhat.com
Wed Apr 28 20:27:25 UTC 2010


When running virsh edit, we are unlinking and setting
the tmp variable to NULL before going to the end of the
function, meaning that we never free tmp.  Since the
exit to the function will always unlink and free tmp,
just remove this bit of code and let it get done at the
end.

Signed-off-by: Chris Lalancette <clalance at redhat.com>
---
 tools/virsh.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 04b47a1..ab099da 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -8066,9 +8066,6 @@ cmdEdit (vshControl *ctl, const vshCmd *cmd)
     doc_edited = editReadBackFile (ctl, tmp);
     if (!doc_edited) goto cleanup;
 
-    unlink (tmp);
-    tmp = NULL;
-
     /* Compare original XML with edited.  Has it changed at all? */
     if (STREQ (doc, doc_edited)) {
         vshPrint (ctl, _("Domain %s XML configuration not changed.\n"),
-- 
1.6.6.1




More information about the libvir-list mailing list