[libvirt] [PATCH v2 4/6] Fix possible memory leak in virsh-domain-monitor.c in cmdDomblklist

Pavel Hrdina phrdina at redhat.com
Thu Jan 16 14:26:54 UTC 2014


On 16.1.2014 14:43, John Ferlan wrote:
>
>
> On 01/16/2014 08:33 AM, Pavel Hrdina wrote:
>> In a "for" loop there are created two new strings and they may not
>> be freed if a "target" string cannot be obtained. We have to free
>> the two created strings to prevent the memory leak.
>>
>> This has been found by coverity.
>>
>> John also pointed out that we should somehow care about the "type"
>> and "device" and Osier agreed to exit with error message if one of
>> them is set to NULL.
>>
>> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
>> ---
>> version 2:
>>   - initialize "type" and "device" to NULL
>>   - exit with error message if "type" and "device" is NULL
>>   - remove a "if (details)" condition before freeing "type" and "device"
>>
>>   tools/virsh-domain-monitor.c | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>
> ACK
>
> John
>

Thanks, pushed.

Pavel




More information about the libvir-list mailing list