xenpm: Initialize cputopo pointer
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Wed, 13 May 2015 17:37:35 +0000 (13:37 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 14 May 2015 08:58:43 +0000 (09:58 +0100)
Commit 250f0b43af1a ("libxl/libxc: Move libxl_get_cpu_topology()'s
hypercall buffer management to libxc") broke non-debug compilation:
on error path we may have uninitialized cputopo pointer.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reported-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/misc/xenpm.c

index 24ee6ef9d2a2a4dde1b3fa50b7930ec528f80466..fe2c001841c9c9c38f7135ef041f99adefabfe96 100644 (file)
@@ -355,7 +355,7 @@ static void signal_int_handler(int signo)
     int i, j, k;
     struct timeval tv;
     int cx_cap = 0, px_cap = 0;
-    xc_cputopo_t *cputopo;
+    xc_cputopo_t *cputopo = NULL;
     unsigned max_cpus;
 
     if ( xc_cputopoinfo(xc_handle, &max_cpus, NULL) != 0 )
@@ -960,7 +960,7 @@ void scaling_governor_func(int argc, char *argv[])
 
 void cpu_topology_func(int argc, char *argv[])
 {
-    xc_cputopo_t *cputopo;
+    xc_cputopo_t *cputopo = NULL;
     unsigned max_cpus;
     int i, rc;