]> xenbits.xensource.com Git - libvirt.git/commitdiff
xend: Fix a memory leak found by Coverity
authorJohn Ferlan <jferlan@redhat.com>
Tue, 29 Jan 2013 14:54:16 +0000 (09:54 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 11 Feb 2013 14:50:01 +0000 (09:50 -0500)
Commit id '87b4c10c' moved the VIR_ALLOC_N, but didn't check if 'cpuset'
had been allocated on failure.

src/xen/xend_internal.c

index 641088c9ccb215a37a6dc245485c1cf0387049db..27b87fc60c5a73b089cdd7caf4ecb9ee79dc4d0a 100644 (file)
@@ -1127,8 +1127,10 @@ sexpr_to_xend_topology(const struct sexpr *root, virCapsPtr caps)
                 goto error;
         }
 
-        if (VIR_ALLOC_N(cpuInfo, numCpus) < 0)
+        if (VIR_ALLOC_N(cpuInfo, numCpus) < 0) {
+            virBitmapFree(cpuset);
             goto memory_error;
+        }
 
         for (n = 0, cpu = 0; cpu < numCpus; cpu++) {
             bool used;