From 6aea4ebcd03f926ee7de6ca3671a5435b56d8ff2 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 20 Aug 2013 13:20:56 -0400 Subject: [PATCH] libxl: Resolve possible NULL dereference If we reached cleanup: prior to allocating cpus, it was possible that 'nr_nodes' had a value, but cpus was NULL leading to a possible NULL deref. Add a 'cpus' as an end condition to for loop --- src/libxl/libxl_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 01626b98a0..8129c7fe1f 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -196,7 +196,7 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps) cleanup: if (ret != 0) { - for (i = 0; i < nr_nodes; i++) + for (i = 0; cpus && i < nr_nodes; i++) VIR_FREE(cpus[i]); virCapabilitiesFreeNUMAInfo(caps); }