Re: [PATCH] virQEMUCapsReset: also clear out hostCPUModel

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

 



On Mon, Oct 24, 2016 at 17:55:06 +0200, Ján Tomko wrote:
> After succesfully reading an outdated caps cache from disk,
> calling virQEMUCapsReset did not properly clear out the host
> CPU model. This lead to a memory leak when the host CPU model
> pointer was overwritten later in virQEMUCapsNewForBinaryInternal.

Well, hostCPUModel is not stored in the cache; it's (going to be)
computed from other fields in the cache so it will still be NULL after
reading caps cache.

> Introduced by commit 68c70118.
> ---
>  src/qemu/qemu_capabilities.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 9132469..130f1db 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -3430,6 +3430,9 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
>  
>      VIR_FREE(qemuCaps->gicCapabilities);
>      qemuCaps->ngicCapabilities = 0;
> +
> +    virCPUDefFree(qemuCaps->hostCPUModel);
> +    qemuCaps->hostCPUModel = NULL;
>  }

But it still makes sense to free it here. ACK.

Jirka

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