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

John Ferlan jferlan at redhat.com
Thu Jan 16 13:43:05 UTC 2014



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




More information about the libvir-list mailing list