From: Hongwei Bi Date: Sat, 31 Aug 2013 03:39:35 +0000 (+0800) Subject: Fix memory leak in cmdAttachDisk X-Git-Tag: v1.1.2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=461b1c8b7bc478c67d627373e559bd5621586a6e;p=thirdparty%2Flibvirt.git Fix memory leak in cmdAttachDisk 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 --- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3fd57fd2c7..568d61d001 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -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);