[PATCH] qemu_cgroup: initialize mem_mask to NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If 'virNumaGetHostNodeset()' fails then the error path will try to free
uninitialized pointer mem_mask. Introduced by commit af2a1f058.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Pushed under trivial rule.

 src/qemu/qemu_cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index fc46450..7b8eed0 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -791,32 +791,32 @@ qemuInitCgroup(virQEMUDriverPtr driver,
 static void
 qemuRestoreCgroupState(virDomainObjPtr vm)
 {
-    char *mem_mask;
+    char *mem_mask = NULL;
     int empty = -1;
     qemuDomainObjPrivatePtr priv = vm->privateData;
     virBitmapPtr all_nodes;
 
     if (!(all_nodes = virNumaGetHostNodeset()))
         goto error;
 
     if (!(mem_mask = virBitmapFormat(all_nodes)))
         goto error;
 
     if ((empty = virCgroupHasEmptyTasks(priv->cgroup,
                                         VIR_CGROUP_CONTROLLER_CPUSET)) <= 0)
         goto error;
 
     if (virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
         goto error;
 
  cleanup:
     VIR_FREE(mem_mask);
     virBitmapFree(all_nodes);
     return;
 
  error:
     virResetLastError();
     VIR_DEBUG("Couldn't restore cgroups to meaningful state");
     goto cleanup;
 }
 
-- 
2.0.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]