[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/21] block/qapi: Fix memory leak in qmp_query_block
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 01/21] block/qapi: Fix memory leak in qmp_query_blockstats() |
Date: |
Wed, 15 Aug 2018 14:55:17 +0200 |
For BlockBackends that are skipped in query-blockstats, we would leak
info since commit 567dcb31. Allocate info only later to avoid the memory
leak.
Fixes: CID 1394727
Cc: address@hidden
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
---
block/qapi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/qapi.c b/block/qapi.c
index 339727f0f4..c66f949db8 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -594,7 +594,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
}
} else {
for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
- BlockStatsList *info = g_malloc0(sizeof(*info));
+ BlockStatsList *info;
AioContext *ctx = blk_get_aio_context(blk);
BlockStats *s;
char *qdev;
@@ -619,6 +619,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
bdrv_query_blk_stats(s->stats, blk);
aio_context_release(ctx);
+ info = g_malloc0(sizeof(*info));
info->value = s;
*p_next = info;
p_next = &info->next;
--
2.13.6
- [Qemu-devel] [PULL 00/21] Block layer patches, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 03/21] throttle-groups: Skip the round-robin if a member is being drained, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 01/21] block/qapi: Fix memory leak in qmp_query_blockstats(),
Kevin Wolf <=
- [Qemu-devel] [PULL 06/21] luks: Allow share-rw=on, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 02/21] qemu-iotests: Test removing a throttle group member with a pending timer, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 04/21] qemu-iotests: Update 093 to improve the draining test, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 05/21] throttle-groups: Don't allow timers without throttled requests, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 07/21] block: Remove deprecated -drive geometry options, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 15/21] block: drop empty .bdrv_close handlers, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 13/21] qemu-img: fix regression copying secrets during convert, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 11/21] qapi/block: Document restrictions for node names, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 09/21] block: Remove deprecated -drive option serial, Kevin Wolf, 2018/08/15
- [Qemu-devel] [PULL 17/21] block: Remove children options from bs->{options, explicit_options}, Kevin Wolf, 2018/08/15