[libvirt PATCH 3/3] virQEMUCapsSetHostModel: Fix memory leak

Peter Krempa pkrempa at redhat.com
Fri Apr 16 08:31:27 UTC 2021


On Thu, Apr 15, 2021 at 17:08:28 +0200, Tim Wiederhake wrote:
> virQEMUCapsSetHostModel is called by virQEMUCapsInitHostCPUModel,
> which in turn is typically called twice (for KVM and QEMU), e.g. in
> virQEMUCapsLoadCache and virQEMUCapsNewForBinaryInternal.
> 
> The second call leaks memory pointed to by "reported", "migratable"
> and "full".

That sounds to me like a usage problem in the caller, where if it's
called twice it's either using a non-cleared variable, or the value will
be overwritten and thus calling it in the first place is probably
dubious, so the proposed patch feels to me like it's fixing a symptom
rather than the real problem.




More information about the libvir-list mailing list