Re: [PATCH 4/5] lxc: Don't leak @veths in virLXCProcessStart

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

 



On Wed, Jul 25, 2018 at 03:02:10PM +0200, Michal Privoznik wrote:
> The individual strings are freed, but the array is never freed.
>
>  8 bytes in 1 blocks are definitely lost in loss record 28 of 1,098
>     at 0x4C2CE3F: malloc (vg_replace_malloc.c:298)
>     by 0x4C2F1BF: realloc (vg_replace_malloc.c:785)
>     by 0x52C9C92: virReallocN (viralloc.c:245)
>     by 0x52C9D88: virExpandN (viralloc.c:294)
>     by 0x23414D99: virLXCProcessSetupInterfaces (lxc_process.c:552)
>     by 0x23417457: virLXCProcessStart (lxc_process.c:1356)
>     by 0x2341F71C: lxcDomainCreateWithFiles (lxc_driver.c:1088)
>     by 0x2341F805: lxcDomainCreate (lxc_driver.c:1123)
>     by 0x55917EB: virDomainCreate (libvirt-domain.c:6534)
>     by 0x1367D1: remoteDispatchDomainCreate (remote_daemon_dispatch_stubs.h:4434)
>     by 0x1366EA: remoteDispatchDomainCreateHelper (remote_daemon_dispatch_stubs.h:4410)
>     by 0x546FDF1: virNetServerProgramDispatchCall (virnetserverprogram.c:437)
>
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/lxc/lxc_process.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
> index 14502e12fe..3e44da1aaf 100644
> --- a/src/lxc/lxc_process.c
> +++ b/src/lxc/lxc_process.c
> @@ -1559,6 +1559,7 @@ int virLXCProcessStart(virConnectPtr conn,
>      virCommandFree(cmd);
>      for (i = 0; i < nveths; i++)
>          VIR_FREE(veths[i]);
> +    VIR_FREE(veths);

Hmm, I'll use this patch to promote the recent (ongoing) work on
__attribute__(cleanup), would you mind converting veths into a NULL-terminated
list so that we could use VIR_AUTOPTR(virString) veths = NULL and thus drop the
manual cleanup? Bonus points if you add a follow-up patch.

Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>

--
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]

  Powered by Linux