From: Chris Lalancette Date: Wed, 28 Apr 2010 19:50:06 +0000 (-0400) Subject: Fix a virsh edit memory leak X-Git-Tag: v0.8.1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=270895063d1cf86ab42fa220a8d090c24d58dbc0;p=thirdparty%2Flibvirt.git Fix a virsh edit memory leak 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 --- diff --git a/tools/virsh.c b/tools/virsh.c index 5bcf0ede9a..a1ad637f61 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -8081,9 +8081,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"),