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

Re: [libvirt] [PATCH] virsh: plug memory leak on cmdDomblkstat



BTW, This patch is missing your review.

Thanks,
Alex

----- Original Message -----
From: "Alex Jia" <ajia redhat com>
To: libvir-list redhat com
Cc: ajia redhat com
Sent: Thursday, December 8, 2011 5:22:51 PM
Subject: Re: [libvirt][PATCH] virsh: plug memory leak on cmdDomblkstat

On 12/08/2011 05:11 PM, ajia redhat com wrote:
> From: Alex Jia<ajia redhat com>
>
> Detected by valgrind. Leak introduced in commit 88a993b:
>
> * tools/virsh.c: fix memory leak on cmdDomblkstat.
>
> * how to reproduce?
>    % valgrind -v --leak-check=full virsh cmdDomblkstat<domain name>
s/cmdDomblkstat/domblklist/, please help fix this comment error before 
applied.

Thanks,
Alex
> * actual valgrind result:
>
> ==6573== 1,836 bytes in 1 blocks are definitely lost in loss record 110 of 124
> ==6573==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
> ==6573==    by 0x330D71497D: xdr_string (in /lib64/libc-2.12.so)
> ==6573==    by 0x4D26CED: xdr_remote_nonnull_string (remote_protocol.c:30)
> ==6573==    by 0x4D28138: xdr_remote_domain_get_xml_desc_ret (remote_protocol.c:1418)
> ==6573==    by 0x4D3C0C2: virNetMessageDecodePayload (virnetmessage.c:382)
> ==6573==    by 0x4D3279F: virNetClientProgramCall (virnetclientprogram.c:382)
> ==6573==    by 0x4D0D50B: callWithFD (remote_driver.c:4339)
> ==6573==    by 0x4D0D5AB: call (remote_driver.c:4360)
> ==6573==    by 0x4D16EAF: remoteDomainGetXMLDesc (remote_client_bodies.h:861)
> ==6573==    by 0x4CF9F4F: virDomainGetXMLDesc (libvirt.c:4098)
> ==6573==    by 0x4154D9: cmdDomblklist (virsh.c:1722)
> ==6573==    by 0x4149E2: vshCommandRun (virsh.c:16365)
> ==6573==
> ==6573== 46,009 (352 direct, 45,657 indirect) bytes in 1 blocks are definitely lost in loss record 123 of 124
> ==6573==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
> ==6573==    by 0x3318286DC6: xmlXPathNewContext (in /usr/lib64/libxml2.so.2.7.6)
> ==6573==    by 0x4C79AE2: virXMLParseHelper (xml.c:779)
> ==6573==    by 0x415512: cmdDomblklist (virsh.c:1726)
> ==6573==    by 0x4149E2: vshCommandRun (virsh.c:16365)
> ==6573==    by 0x427743: main (virsh.c:17867)
> ==6573==
> ==6573== LEAK SUMMARY:
> ==6573==    definitely lost: 2,188 bytes in 2 blocks
> ==6573==    indirectly lost: 45,657 bytes in 332 blocks
> ==6573==      possibly lost: 0 bytes in 0 blocks
> ==6573==    still reachable: 128,034 bytes in 1,364 blocks
> ==6573==         suppressed: 0 bytes in 0 blocks
>
>
> Signed-off-by: Alex Jia<ajia redhat com>
> ---
>   tools/virsh.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/tools/virsh.c b/tools/virsh.c
> index a51478f..7c2f3fc 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -1757,6 +1757,9 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
>   cleanup:
>       VIR_FREE(disks);
>       virDomainFree(dom);
> +    VIR_FREE(xml);
> +    xmlFreeDoc(xmldoc);
> +    xmlXPathFreeContext(ctxt);
>       return ret;
>   }
>


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