[libvirt PATCH 4/4] testUpdateQEMUCaps: Fix memory leak

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

 



testUpdateQEMUCaps is called multiple times. Use virQEMUCapsUpdateHostCPUModel
instead of virQEMUCapsInitHostCPUModel to not overwrite (and leak) the
pointers in qemuCaps->kvm.hostCPU and qemuCaps->tcg.hostCPU.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 572c7b251a..f0efe98d7e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -367,10 +367,10 @@ testUpdateQEMUCaps(const struct testQemuInfo *info,
                          !!(info->flags & FLAG_SKIP_LEGACY_CPUS)) < 0)
         return -1;
 
-    virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
-                                VIR_DOMAIN_VIRT_KVM);
-    virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
-                                VIR_DOMAIN_VIRT_QEMU);
+    virQEMUCapsUpdateHostCPUModel(info->qemuCaps, caps->host.arch,
+                                  VIR_DOMAIN_VIRT_KVM);
+    virQEMUCapsUpdateHostCPUModel(info->qemuCaps, caps->host.arch,
+                                  VIR_DOMAIN_VIRT_QEMU);
 
     return 0;
 }
-- 
2.26.3




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

  Powered by Linux