]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Don't double free @node_cpus in qemuProcessSetupPid()
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 23 Apr 2021 08:05:50 +0000 (10:05 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 23 Apr 2021 09:02:21 +0000 (11:02 +0200)
When placing vCPUs into CGroups the qemuProcessSetupPid() is
called which then enters a for() loop (around its middle) where
it calls virDomainNumaGetNodeCpumask() for each guest NUMA node.
But the latter returns only a pointer not new reference/copy and
thus the caller must not free it. But the variable is decorated
with g_autoptr() which leads to a double free.

Fixes: 2d37d8dbc987d1998b4ad8029ba324b6bfe49799
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_process.c

index 05104e309877e9012e6b2f07622a1b5f332038e3..92c1f0ab7432b7445a6b793c3bb3a398b80047e3 100644 (file)
@@ -2741,8 +2741,7 @@ qemuProcessSetupPid(virDomainObj *vm,
 
             /* Look for the guest NUMA node of this vCPU */
             for (i = 0; i < virDomainNumaGetNodeCount(numatune); i++) {
-                g_autoptr(virBitmap) node_cpus = NULL;
-                node_cpus = virDomainNumaGetNodeCpumask(numatune, i);
+                virBitmap *node_cpus = virDomainNumaGetNodeCpumask(numatune, i);
 
                 if (!virBitmapIsBitSet(node_cpus, id))
                     continue;