]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: fix out-of-memory error handling in libxl_list_cpupool
authorMatthew Daley <mattjd@gmail.com>
Tue, 10 Sep 2013 10:18:46 +0000 (22:18 +1200)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 10 Oct 2013 14:49:54 +0000 (15:49 +0100)
...otherwise it will return freed memory. All the current users of this
function check already for a NULL return, so use that.

Coverity-ID: 1056194

This is CVE-2013-4371 / XSA-70

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.c

index b6daceaf9bee2538bf2bfdabac13d80c57c4f89a..29e66f27d0162f8a4a38f5162f1d3e1988dc915c 100644 (file)
@@ -654,6 +654,7 @@ libxl_cpupoolinfo * libxl_list_cpupool(libxl_ctx *ctx, int *nb_pool_out)
         if (!tmp) {
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "allocating cpupool info");
             libxl_cpupoolinfo_list_free(ptr, i);
+            ptr = NULL;
             goto out;
         }
         ptr = tmp;