]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Add VIR_FREE in ADD_BITMAP
authorAnastasia Belova <abelova@astralinux.ru>
Thu, 28 Sep 2023 11:55:11 +0000 (14:55 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 29 Sep 2023 07:14:54 +0000 (09:14 +0200)
virBitmapFormat returns the string that should be freed.

All strings in three ADD_BITMAP calls in qemuDomainGetGuestVcpusParams
are contained in tmp. So memory leak is possible here without VIR_FREE.

Fixes: 0108deb944af5ca6f1da350c9d0352c8ed18738b
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_driver.c

index 9e0f204e443b9d930df932e847c9f76e885798fb..056b5cec985284292a0ef38009cc9ff906b07879 100644 (file)
@@ -18420,6 +18420,7 @@ qemuDomainGetGuestVcpusParams(virTypedParameterPtr *params,
         goto cleanup; \
     if (virTypedParamsAddString(&par, &npar, &maxpar, #name, tmp) < 0) \
         goto cleanup; \
+    VIR_FREE(tmp)
 
     ADD_BITMAP(vcpus);
     ADD_BITMAP(online);