Re: [PATCH] qemu: Fix memory leak when building -cpu argument

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

 



On 02/08/2012 06:38 AM, Jiri Denemark wrote:
> Reported by Alex Jia:
> 
> ==21503== 112 (32 direct, 80 indirect) bytes in 1 blocks are
> definitely lost in loss record 37 of 40
> ==21503==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
> ==21503==    by 0x4A8991: virAlloc (memory.c:101)
> ==21503==    by 0x505A6C: x86DataCopy (cpu_x86.c:247)
> ==21503==    by 0x507B34: x86Compute (cpu_x86.c:1225)
> ==21503==    by 0x43103C: qemuBuildCommandLine (qemu_command.c:3561)
> ==21503==    by 0x41C9F7: testCompareXMLToArgvHelper
> (qemuxml2argvtest.c:183)
> ==21503==    by 0x41E10D: virtTestRun (testutils.c:141)
> ==21503==    by 0x41B942: mymain (qemuxml2argvtest.c:705)
> ==21503==    by 0x41D7E7: virtTestMain (testutils.c:696)
> ---
> 
> I should really stop postponing my work to emebed the architecture into
> cpu data so that cpuDataFree() only needs one argument.
> 
>  src/qemu/qemu_command.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 0e26df1..a346f1e 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -3666,8 +3666,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
>      ret = 0;
>  
>  cleanup:
> -    if (guest)
> -        cpuDataFree(guest->arch, data);
> +    cpuDataFree(host->arch, data);

ACK.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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