From f9799f1abffec85141550ac280a9a7809f21de0a Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 29 Jan 2013 09:54:16 -0500 Subject: [PATCH] xend: Fix a memory leak found by Coverity Commit id '87b4c10c' moved the VIR_ALLOC_N, but didn't check if 'cpuset' had been allocated on failure. --- src/xen/xend_internal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 641088c9cc..27b87fc60c 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -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; -- GitLab