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>
master
Marc-André Lureau 2016-07-13 02:39:13 +02:00
parent 51009170d8
commit 157e94e8a2
1 changed files with 8 additions and 7 deletions

15
numa.c
View File

@ -223,14 +223,14 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
} }
if (err) { if (err) {
goto error; goto end;
} }
switch (object->type) { switch (object->type) {
case NUMA_OPTIONS_KIND_NODE: case NUMA_OPTIONS_KIND_NODE:
numa_node_parse(object->u.node.data, opts, &err); numa_node_parse(object->u.node.data, opts, &err);
if (err) { if (err) {
goto error; goto end;
} }
nb_numa_nodes++; nb_numa_nodes++;
break; break;
@ -238,15 +238,16 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
abort(); abort();
} }
return 0; end:
error:
error_report_err(err);
qapi_free_NumaOptions(object); 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) static char *enumerate_cpus(unsigned long *cpus, int max_cpus)
{ {
int cpu; int cpu;