Skip to content

Commit

Permalink
numa: do not leak NumaOptions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
elmarco committed Aug 7, 2016
1 parent 5100917 commit 157e94e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions numa.c
Expand Up @@ -223,28 +223,29 @@ 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;
default:
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)
Expand Down

0 comments on commit 157e94e

Please sign in to comment.