Skip to content

Commit

Permalink
block/qapi: Plug memory leak on query-block error path
Browse files Browse the repository at this point in the history
Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
Markus Armbruster authored and kevmw committed Nov 25, 2015
1 parent 98caa5b commit 903c341
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions block/qapi.c
Expand Up @@ -436,18 +436,16 @@ BlockInfoList *qmp_query_block(Error **errp)
bdrv_query_info(blk, &info->value, &local_err);
if (local_err) {
error_propagate(errp, local_err);
goto err;
g_free(info);
qapi_free_BlockInfoList(head);
return NULL;
}

*p_next = info;
p_next = &info->next;
}

return head;

err:
qapi_free_BlockInfoList(head);
return NULL;
}

BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
Expand Down

0 comments on commit 903c341

Please sign in to comment.