Re: [PATCH] virsh-domain: Fix memleak in cmdUndefine with storage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/12/2013 04:13 PM, Peter Krempa wrote:
> When undefining a domain with storage when the volume isn't managed by
> libvirt the name and path strings weren't freed properly.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=996050
> ---
>  tools/virsh-domain.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

> @@ -3090,6 +3092,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
>              }
>              vlist[nvols].source = source;
>              vlist[nvols].target = target;
> +            source = NULL;
> +            target = NULL;
>              nvols++;
>          }
> 

Using VIR_APPEND_ELEMENT here might look nicer, but that's just cosmetic.

However this patch is incomplete - there's also a leak of volume_tokens
mentioned in the bug that you didn't address:

==19011== 10 bytes in 1 blocks are definitely lost in loss record 14 of 82
==19011==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==19011==    by 0x38F0881041: strdup (in /lib64/libc-2.12.so)
==19011==    by 0x40EB00: _vshStrdup (virsh.c:129)
==19011==    by 0x40FC28: vshStringToArray (virsh.c:182)
==19011==    by 0x414A66: cmdUndefine (virsh-domain.c:2609)
==19011==    by 0x40D200: vshCommandRun (virsh.c:1652)
==19011==    by 0x410964: main (virsh.c:3073)

Maybe virStringSplit would give us an array that's easier to steal from?

Jan

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]