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

[Xen-devel] [PATCH 13/28] libxl: only free cputopology if it was allocated in libxl_{cpu, node}map_to_{node, cpu}map



Coverity-ID: 1055294
Coverity-ID: 1055295
Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
---
 tools/libxl/libxl_utils.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index 4309e5e..8e567a8 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -664,7 +664,8 @@ int libxl_nodemap_to_cpumap(libxl_ctx *ctx,
             libxl_bitmap_set(cpumap, i);
     }
  out:
-    libxl_cputopology_list_free(tinfo, nr_cpus);
+    if (tinfo != NULL)
+        libxl_cputopology_list_free(tinfo, nr_cpus);
     return rc;
 }
 
@@ -685,7 +686,8 @@ int libxl_cpumap_to_nodemap(libxl_ctx *ctx,
     libxl_for_each_set_bit(i, *cpumap)
         libxl_bitmap_set(nodemap, tinfo[i].node);
  out:
-    libxl_cputopology_list_free(tinfo, nr_cpus);
+    if (tinfo != NULL)
+        libxl_cputopology_list_free(tinfo, nr_cpus);
     return rc;
 }
 
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.