]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Don't leak cpu defs
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 30 Jul 2021 08:34:50 +0000 (10:34 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 5 Aug 2021 12:53:19 +0000 (14:53 +0200)
There are cpu definitions that are allocated in
qemuTestDriverInit() but are missing corresponding
virCPUDefFree() call in qemuTestDriverFree(). It's safe to call
the free function because the definitions contain a refcounter
and thus even if they were still in use the refcounter would be
just decreased.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/testutilsqemu.c

index fab676c070cf5ba5b0f0315ddb2dee544a8ba6ec..9a0666724a85cba156cb9f97faff6c5547404e57 100644 (file)
@@ -332,6 +332,11 @@ void qemuTestDriverFree(virQEMUDriver *driver)
     virObjectUnref(driver->caps);
     virObjectUnref(driver->config);
     virObjectUnref(driver->securityManager);
+
+    virCPUDefFree(cpuDefault);
+    virCPUDefFree(cpuHaswell);
+    virCPUDefFree(cpuPower8);
+    virCPUDefFree(cpuPower9);
 }
 
 int qemuTestCapsCacheInsert(virFileCache *cache,