]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix memory leak in cmdAttachDisk
authorHongwei Bi <hwbi2008@gmail.com>
Sat, 31 Aug 2013 03:39:35 +0000 (11:39 +0800)
committerEric Blake <eblake@redhat.com>
Sat, 31 Aug 2013 21:50:23 +0000 (15:50 -0600)
When virBufferError is ok in cmdAttachDisk, the latter
should 'goto cleanup', instead of returning a false to
prevent memory leaking.

Signed-off-by: Eric Blake <eblake@redhat.com>
tools/virsh-domain.c

index 3fd57fd2c71ee43e1dbea714008c5253ea6fd9fe..568d61d001b47fd3a3fc149912ea45f7cafb52f1 100644 (file)
@@ -661,7 +661,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
 
     if (virBufferError(&buf)) {
         vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
-        return false;
+        goto cleanup;
     }
 
     xml = virBufferContentAndReset(&buf);