render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
43fe83
From f937ef18118e499e5049bca012bed51ccc5d2b3e Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <f937ef18118e499e5049bca012bed51ccc5d2b3e.1380703761.git.jdenemar@redhat.com>
43fe83
From: Jiri Denemark <jdenemar@redhat.com>
43fe83
Date: Fri, 27 Sep 2013 16:02:39 +0200
43fe83
Subject: [PATCH] qemu: Don't leak reference to virQEMUDriverConfigPtr
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=1011330 (case D)
43fe83
43fe83
qemuProcessStart created two references to virQEMUDriverConfigPtr before
43fe83
calling fork():
43fe83
43fe83
    cfg = virQEMUDriverGetConfig(driver);
43fe83
    ...
43fe83
    hookData.cfg = virObjectRef(cfg);
43fe83
43fe83
However, the child only unreferenced hookData.cfg and the parent only
43fe83
removed the cfg reference. That said, we don't need to increment the
43fe83
reference counter when assigning cfg to hookData. Both the child and the
43fe83
parent will correctly remove the reference on cfg (the child will do
43fe83
that through hookData).
43fe83
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
(cherry picked from commit 833cdab6d2ad7521c954948adf3c7d3c3b42ae9f)
43fe83
---
43fe83
 src/qemu/qemu_process.c | 3 ++-
43fe83
 1 file changed, 2 insertions(+), 1 deletion(-)
43fe83
43fe83
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
43fe83
index 843ff76..1bd0d04 100644
43fe83
--- a/src/qemu/qemu_process.c
43fe83
+++ b/src/qemu/qemu_process.c
43fe83
@@ -3475,7 +3475,8 @@ int qemuProcessStart(virConnectPtr conn,
43fe83
     hookData.conn = conn;
43fe83
     hookData.vm = vm;
43fe83
     hookData.driver = driver;
43fe83
-    hookData.cfg = virObjectRef(cfg);
43fe83
+    /* We don't increase cfg's reference counter here. */
43fe83
+    hookData.cfg = cfg;
43fe83
 
43fe83
     VIR_DEBUG("Beginning VM startup process");
43fe83
 
43fe83
-- 
43fe83
1.8.3.2
43fe83