* [Qemu-devel] [PATCH] block/qapi: Plug memory leak on query-block error path
@ 2015-11-20 12:53 Markus Armbruster
2015-11-20 17:57 ` [Qemu-devel] [PATCH for-2.5] " Eric Blake
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Markus Armbruster @ 2015-11-20 12:53 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, qemu-block
Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
block/qapi.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/block/qapi.c b/block/qapi.c
index d20262d..267f147 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -436,7 +436,9 @@ 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;
@@ -444,10 +446,6 @@ BlockInfoList *qmp_query_block(Error **errp)
}
return head;
-
- err:
- qapi_free_BlockInfoList(head);
- return NULL;
}
BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
--
2.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Qemu-devel] [PATCH for-2.5] block/qapi: Plug memory leak on query-block error path
2015-11-20 12:53 [Qemu-devel] [PATCH] block/qapi: Plug memory leak on query-block error path Markus Armbruster
@ 2015-11-20 17:57 ` Eric Blake
2015-11-20 18:00 ` [Qemu-devel] [PATCH] " Eric Blake
2015-11-23 10:10 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2015-11-20 17:57 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: kwolf, qemu-block
[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]
On 11/20/2015 05:53 AM, Markus Armbruster wrote:
> Spotted by Coverity.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> block/qapi.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/block/qapi.c b/block/qapi.c
> index d20262d..267f147 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -436,7 +436,9 @@ 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;
> }
>
Only info was leaked, but inlining the entire 'err' label into its one
use was easier than hoisting the declaration of info out of the loop.
Reviewed-by: Eric Blake <eblake@redhat.com>
> *p_next = info;
> @@ -444,10 +446,6 @@ BlockInfoList *qmp_query_block(Error **errp)
> }
>
> return head;
> -
> - err:
> - qapi_free_BlockInfoList(head);
> - return NULL;
> }
>
> BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Qemu-devel] [PATCH] block/qapi: Plug memory leak on query-block error path
2015-11-20 12:53 [Qemu-devel] [PATCH] block/qapi: Plug memory leak on query-block error path Markus Armbruster
2015-11-20 17:57 ` [Qemu-devel] [PATCH for-2.5] " Eric Blake
@ 2015-11-20 18:00 ` Eric Blake
2015-11-23 10:10 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2015-11-20 18:00 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: kwolf, qemu-block
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
On 11/20/2015 05:53 AM, Markus Armbruster wrote:
> Spotted by Coverity.
Worth mentioning that commit 553a7e87 was the culprit.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> block/qapi.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block/qapi: Plug memory leak on query-block error path
2015-11-20 12:53 [Qemu-devel] [PATCH] block/qapi: Plug memory leak on query-block error path Markus Armbruster
2015-11-20 17:57 ` [Qemu-devel] [PATCH for-2.5] " Eric Blake
2015-11-20 18:00 ` [Qemu-devel] [PATCH] " Eric Blake
@ 2015-11-23 10:10 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2015-11-23 10:10 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel, qemu-block
Am 20.11.2015 um 13:53 hat Markus Armbruster geschrieben:
> Spotted by Coverity.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-23 10:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20 12:53 [Qemu-devel] [PATCH] block/qapi: Plug memory leak on query-block error path Markus Armbruster
2015-11-20 17:57 ` [Qemu-devel] [PATCH for-2.5] " Eric Blake
2015-11-20 18:00 ` [Qemu-devel] [PATCH] " Eric Blake
2015-11-23 10:10 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).