[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 17/97] block/qapi: Fix memory leak in qmp_query_blo
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 17/97] block/qapi: Fix memory leak in qmp_query_blockstats() |
Date: |
Mon, 1 Apr 2019 15:58:51 -0500 |
From: Kevin Wolf <address@hidden>
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>
(cherry picked from commit f62492bb8d1ea7f7e156ffbdf411de46107072c5)
Signed-off-by: Michael Roth <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.17.1
- [Qemu-stable] [PATCH 00/97] Patch Round-up for stable 3.0.1, freeze on 2019-04-08, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 09/97] target/arm: Reformat integer register dump, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 13/97] target/arm: Adjust FPCR_MASK for FZ16, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 08/97] target/arm: Fix offset scaling for LD_zprr and ST_zprr, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 10/97] target/arm: Dump SVE state if enabled, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 14/97] target/arm: Ignore float_flag_input_denormal from fp_status_f16, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 18/97] mirror: Fail gracefully for source == target, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 12/97] spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 22/97] aio: Do aio_notify_accept only during blocking aio_poll, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 11/97] target/arm: Add sve-max-vq cpu property to -cpu max, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 17/97] block/qapi: Fix memory leak in qmp_query_blockstats(),
Michael Roth <=
- [Qemu-stable] [PATCH 21/97] aio-posix: Don't count ctx->notifier as progress when polling, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 16/97] target/arm: Use FZ not FZ16 for SVE FCVT single-half and double-half, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 29/97] target/xtensa: fix FPU2000 bugs, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 35/97] block: Fix use after free error in bdrv_open_inherit(), Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 23/97] monitor: fix oob command leak, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 30/97] kvm: add call to qemu_add_opts() for -overcommit option, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 20/97] nvme: Fix nvme_init error handling, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 33/97] pc: acpi: revert back to 1 SRAT entry for hotpluggable area, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 36/97] job: Fix nested aio_poll() hanging in job_txn_apply, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 37/97] target/xtensa: fix s32c1i TCGMemOp flags, Michael Roth, 2019/04/01