From: John Ferlan Date: Tue, 20 Aug 2013 17:20:56 +0000 (-0400) Subject: libxl: Resolve possible NULL dereference X-Git-Tag: v1.1.2-rc1~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6aea4ebcd03f926ee7de6ca3671a5435b56d8ff2;p=thirdparty%2Flibvirt.git 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 --- 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); }