]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix a virsh edit memory leak
authorChris Lalancette <clalance@redhat.com>
Wed, 28 Apr 2010 19:50:06 +0000 (15:50 -0400)
committerChris Lalancette <clalance@redhat.com>
Thu, 29 Apr 2010 13:16:33 +0000 (09:16 -0400)
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@redhat.com>
tools/virsh.c

index 5bcf0ede9aeb68976abc79e79b349f32456b1341..a1ad637f61825f69a4e3233e3c645c286a1dbbb8 100644 (file)
@@ -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"),