]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Don't leak reference to virQEMUDriverConfigPtr
authorJiri Denemark <jdenemar@redhat.com>
Fri, 27 Sep 2013 13:07:38 +0000 (15:07 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 27 Sep 2013 13:57:14 +0000 (15:57 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1011330 (case D)

qemuProcessStart created two references to virQEMUDriverConfigPtr before
calling fork():

    cfg = virQEMUDriverGetConfig(driver);
    ...
    hookData.cfg = virObjectRef(cfg);

However, the child only unreferenced hookData.cfg and the parent only
removed the cfg reference. That said, we don't need to increment the
reference counter when assigning cfg to hookData. Both the child and the
parent will correctly remove the reference on cfg (the child will do
that through hookData).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_process.c

index 2b9bfe3949afef826cb0abdf12ca99c25f6f723f..d7be7319c3612c6b16ca1e8f09fd781b769dfd82 100644 (file)
@@ -3520,7 +3520,8 @@ int qemuProcessStart(virConnectPtr conn,
     hookData.conn = conn;
     hookData.vm = vm;
     hookData.driver = driver;
-    hookData.cfg = virObjectRef(cfg);
+    /* We don't increase cfg's reference counter here. */
+    hookData.cfg = cfg;
 
     VIR_DEBUG("Beginning VM startup process");