[libvirt] [PATCH] 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. --- tools/virsh-domain.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3fd57fd..568d61d 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); -- 1.7.1

On 08/30/2013 09:39 PM, hwbi wrote:
When virBufferError is ok in cmdAttachDisk,the latter should 'goto cleanup',instead of returning a false to
space after ',' in English (twice)
prevent memory leaking. --- tools/virsh-domain.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
ACK. However, we request that you use a legal name for your submissions; is there something a bit more formal than "hwbi" that I should use for the authorship of this patch?
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3fd57fd..568d61d 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);
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 08/31/2013 09:25 AM, hw bi wrote:
I am very glad to see your reply so fast. You can use 'Hongwei Bi' as my name. If I need to
report the bug again, please let me know. Thanks.
Thanks, your patch is now pushed. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
hw bi
-
hwbi