[libvirt] [PATCH] remote: Fix memory leak in remoteConnectGetAllDomainStats
Michal Privoznik
mprivozn at redhat.com
Wed Nov 5 13:19:30 UTC 2014
On 05.11.2014 12:45, Peter Krempa wrote:
> The remote call actually doesn't free the arguments array so we leak
> memory in case a domain list is specified. As the remote domain list
> array consists only of stolen pointers from the actual domain objects
> it's sufficient just to free the array.
>
> Valgrind message:
> ==1081452== 64 bytes in 1 blocks are definitely lost in loss record 632 of 726
> ==1081452== at 0x4C296D0: calloc (vg_replace_malloc.c:618)
> ==1081452== by 0x4EA5CB4: virAllocN (viralloc.c:191)
> ==1081452== by 0x505D21E: remoteConnectGetAllDomainStats (remote_driver.c:7785)
> ==1081452== by 0x50081AA: virDomainListGetStats (libvirt-domain.c:11080)
> ==1081452== by 0x155249: cmdDomstats (virsh-domain-monitor.c:2147)
> ==1081452== by 0x12FB73: vshCommandRun (virsh.c:1935)
> ==1081452== by 0x133FEB: main (virsh.c:3719)
> ---
> src/remote/remote_driver.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 65c04d9..d111e10 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -7846,6 +7846,7 @@ remoteConnectGetAllDomainStats(virConnectPtr conn,
> VIR_FREE(elem);
> }
> virDomainStatsRecordListFree(tmpret);
> + VIR_FREE(args.doms.doms_val);
> xdr_free((xdrproc_t)xdr_remote_connect_get_all_domain_stats_ret,
> (char *) &ret);
>
ACK
Michal
More information about the libvir-list
mailing list