]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Avoid memory leak in virQEMUCapsCPUDefsToModels
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 10 Oct 2022 13:37:17 +0000 (15:37 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 10 Oct 2022 13:47:54 +0000 (15:47 +0200)
commit68bf64778846baade8ffcc40cc17b0e9d1d78545
tree09fa2634760bd1bcc60df5c9d2bbfecd4fc713a8
parent14573868ea7b8df716f80be6a0a00584954e5693
qemu: Avoid memory leak in virQEMUCapsCPUDefsToModels

The @vendor variable inside virQEMUCapsCPUDefsToModels() is
allocated, but never freed. But there is actually no need for it
to be allocated, because it merely passes a retval of
virCPUGetVendorForModel() (which returns a const string) to
virDomainCapsCPUModelsAdd() (which ten accepts the argument as
const string). Therefore, drop the g_strdup() call and fix the
type of the variable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_capabilities.c