[libvirt] [PATCH] qemu: check the validity of a pointer

Matthias Gatto matthias.gatto at outscale.com
Mon Feb 16 20:17:17 UTC 2015


In the current code if mem_mask is NULL there is a "goto error", but
we freeing it without knowing if mem_mask is NULL or not, therefor
I've had a check.

Signed-off-by: Matthias Gatto <matthias.gatto at outscale.com>
---
 src/qemu/qemu_cgroup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index ca255c8..926726c 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -810,7 +810,8 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
         goto error;
 
  cleanup:
-    VIR_FREE(mem_mask);
+    if (mem_mask)
+        VIR_FREE(mem_mask);
     virBitmapFree(all_nodes);
     return;
 
-- 
1.8.3.1




More information about the libvir-list mailing list