[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/17] block: fix memleaks in bdrv_refresh_filename
From: |
Max Reitz |
Subject: |
[PULL 03/17] block: fix memleaks in bdrv_refresh_filename |
Date: |
Thu, 6 Feb 2020 13:51:18 +0100 |
From: Pan Nengyuan <address@hidden>
If we call the qmp 'query-block' while qemu is working on
'block-commit', it will cause memleaks, the memory leak stack is as
follow:
Indirect leak of 12360 byte(s) in 3 object(s) allocated from:
#0 0x7f80f0b6d970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7f80ee86049d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x55ea95b5bb67 in qdict_new /mnt/sdb/qemu-4.2.0-rc0/qobject/qdict.c:29
#3 0x55ea956cd043 in bdrv_refresh_filename
/mnt/sdb/qemu-4.2.0-rc0/block.c:6427
#4 0x55ea956cc950 in bdrv_refresh_filename
/mnt/sdb/qemu-4.2.0-rc0/block.c:6399
#5 0x55ea956cc950 in bdrv_refresh_filename
/mnt/sdb/qemu-4.2.0-rc0/block.c:6399
#6 0x55ea956cc950 in bdrv_refresh_filename
/mnt/sdb/qemu-4.2.0-rc0/block.c:6399
#7 0x55ea958818ea in bdrv_block_device_info
/mnt/sdb/qemu-4.2.0-rc0/block/qapi.c:56
#8 0x55ea958879de in bdrv_query_info
/mnt/sdb/qemu-4.2.0-rc0/block/qapi.c:392
#9 0x55ea9588b58f in qmp_query_block
/mnt/sdb/qemu-4.2.0-rc0/block/qapi.c:578
#10 0x55ea95567392 in qmp_marshal_query_block
qapi/qapi-commands-block-core.c:95
Indirect leak of 4120 byte(s) in 1 object(s) allocated from:
#0 0x7f80f0b6d970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7f80ee86049d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x55ea95b5bb67 in qdict_new /mnt/sdb/qemu-4.2.0-rc0/qobject/qdict.c:29
#3 0x55ea956cd043 in bdrv_refresh_filename
/mnt/sdb/qemu-4.2.0-rc0/block.c:6427
#4 0x55ea956cc950 in bdrv_refresh_filename
/mnt/sdb/qemu-4.2.0-rc0/block.c:6399
#5 0x55ea956cc950 in bdrv_refresh_filename
/mnt/sdb/qemu-4.2.0-rc0/block.c:6399
#6 0x55ea9569f301 in bdrv_backing_attach
/mnt/sdb/qemu-4.2.0-rc0/block.c:1064
#7 0x55ea956a99dd in bdrv_replace_child_noperm
/mnt/sdb/qemu-4.2.0-rc0/block.c:2283
#8 0x55ea956b9b53 in bdrv_replace_node /mnt/sdb/qemu-4.2.0-rc0/block.c:4196
#9 0x55ea956b9e49 in bdrv_append /mnt/sdb/qemu-4.2.0-rc0/block.c:4236
#10 0x55ea958c3472 in commit_start
/mnt/sdb/qemu-4.2.0-rc0/block/commit.c:306
#11 0x55ea94b68ab0 in qmp_block_commit
/mnt/sdb/qemu-4.2.0-rc0/blockdev.c:3459
#12 0x55ea9556a7a7 in qmp_marshal_block_commit
qapi/qapi-commands-block-core.c:407
Fixes: bb808d5f5c0978828a974d547e6032402c339555
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Pan Nengyuan <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block.c b/block.c
index fe5050c53f..9c810534d6 100644
--- a/block.c
+++ b/block.c
@@ -6442,6 +6442,7 @@ void bdrv_refresh_filename(BlockDriverState *bs)
child->bs->exact_filename);
pstrcpy(bs->filename, sizeof(bs->filename), child->bs->filename);
+ qobject_unref(bs->full_open_options);
bs->full_open_options = qobject_ref(child->bs->full_open_options);
return;
--
2.24.1
- [PULL 00/17] Block patches, Max Reitz, 2020/02/06
- [PULL 01/17] qcow2: Assert that host cluster offsets fit in L2 table entries, Max Reitz, 2020/02/06
- [PULL 02/17] block: Use a GString in bdrv_perm_names(), Max Reitz, 2020/02/06
- [PULL 03/17] block: fix memleaks in bdrv_refresh_filename,
Max Reitz <=
- [PULL 04/17] qcow2: Use a GString in report_unsupported_feature(), Max Reitz, 2020/02/06
- [PULL 05/17] iotests: remove 'linux' from default supported platforms, Max Reitz, 2020/02/06
- [PULL 06/17] iotests: Test 041 only works on certain systems, Max Reitz, 2020/02/06
- [PULL 07/17] iotests: Test 183 does not work on macOS and OpenBSD, Max Reitz, 2020/02/06
- [PULL 09/17] iotests: Skip Python-based tests if QEMU does not support virtio-blk, Max Reitz, 2020/02/06
- [PULL 08/17] iotests: Check for the availability of the required devices in 267 and 127, Max Reitz, 2020/02/06
- [PULL 10/17] iotests: Enable more tests in the 'auto' group to improve test coverage, Max Reitz, 2020/02/06
- [PULL 12/17] qcow2: Tighten cluster_offset alignment assertions, Max Reitz, 2020/02/06
- [PULL 11/17] qcow2: Don't round the L1 table allocation up to the sector size, Max Reitz, 2020/02/06
- [PULL 13/17] qcow2: Use bs->bl.request_alignment when updating an L1 entry, Max Reitz, 2020/02/06