qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [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

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).