[libvirt] [PATCH] qemuMonitorTextAttachDrive: avoid two leaks

Jim Meyering jim at meyering.net
Mon Jan 25 21:07:56 UTC 2010


Daniel P. Berrange wrote:
> On Mon, Jan 25, 2010 at 08:30:19PM +0100, Jim Meyering wrote:
>> Coverity reported the first leak: return-(-1)-would-leak-"safe_str".
>> I spotted the 2nd.
>>
>> >From 6326ab7b52f3550f24015c27407c1d3c2a1fd64d Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering at redhat.com>
>> Date: Mon, 25 Jan 2010 20:19:01 +0100
>> Subject: [PATCH] qemuMonitorTextAttachDrive: avoid two leaks
>>
>> * src/qemu/qemu_monitor_text.c (qemuMonitorTextAttachDrive): Most other
>> failures in this function would "goto cleanup", but one mistakenly
>> returned directly, skipping the cleanup and resulting in a leak.
>> In addition, iterating the "try_command" loop would clobber, and
>> thus leak, the "cmd" allocated on the first iteration,
>> so be careful to free it in addition to "reply" beforehand.
...
> ACK

Pushed.  Thanks.




More information about the libvir-list mailing list