]> xenbits.xensource.com Git - 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)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 7 Apr 2016 10:50:15 +0000 (12:50 +0200)
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

src/qemu/qemu_process.c

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