aboutsummaryrefslogtreecommitdiff
path: root/numa.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-07-13 02:39:13 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2016-08-07 23:59:59 +0400
commit157e94e8a2f7d3e14060d833bd1519a83099eaa9 (patch)
treef728c902fc26899a1fcb2a7a986fe423069e2c91 /numa.c
parent51009170d8fc263cfdcd5a60fe3ba213daa3d15b (diff)
downloadqemu-157e94e8a2f7d3e14060d833bd1519a83099eaa9.zip
qemu-157e94e8a2f7d3e14060d833bd1519a83099eaa9.tar.gz
qemu-157e94e8a2f7d3e14060d833bd1519a83099eaa9.tar.bz2
numa: do not leak NumaOptions
In all cases, call qapi_free_NumaOptions(), by using a common ending block. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'numa.c')
-rw-r--r--numa.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/numa.c b/numa.c
index 7286171..6289f46 100644
--- a/numa.c
+++ b/numa.c
@@ -223,14 +223,14 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
}
if (err) {
- goto error;
+ goto end;
}
switch (object->type) {
case NUMA_OPTIONS_KIND_NODE:
numa_node_parse(object->u.node.data, opts, &err);
if (err) {
- goto error;
+ goto end;
}
nb_numa_nodes++;
break;
@@ -238,13 +238,14 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
abort();
}
- return 0;
-
-error:
- error_report_err(err);
+end:
qapi_free_NumaOptions(object);
+ if (err) {
+ error_report_err(err);
+ return -1;
+ }
- return -1;
+ return 0;
}
static char *enumerate_cpus(unsigned long *cpus, int max_cpus)