]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: perf: Fix crash/memory corruption on failed VM start
authorPeter Krempa <pkrempa@redhat.com>
Thu, 7 Apr 2016 10:50:15 +0000 (12:50 +0200)
committerCole Robinson <crobinso@redhat.com>
Wed, 20 Apr 2016 13:10:34 +0000 (09:10 -0400)
The new perf code didn't bother to clear a pointer in 'priv' causing a
double free or other memory corruption goodness if a VM failed to start.

Clear the pointer after freeing the memory.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1324757
(cherry picked from commit 03e8d5fb54c7c897225ed9ea56d83b894930f144)

src/qemu/qemu_process.c

index d9dca74853873a50ef17a99ed170e95ede21d1d6..e3df26563cc149120dad09248cbd4f8b9a5f00ec 100644 (file)
@@ -3444,6 +3444,7 @@ qemuDomainPerfRestart(virDomainObjPtr vm)
 
  cleanup:
     virPerfFree(priv->perf);
+    priv->perf = NULL;
     return -1;
 }
 
@@ -5959,6 +5960,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     virCgroupFree(&priv->cgroup);
 
     virPerfFree(priv->perf);
+    priv->perf = NULL;
 
     qemuProcessRemoveDomainStatus(driver, vm);