[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/34] throttle-groups: fix memory leak in throttle_group_set_limi
From: |
Max Reitz |
Subject: |
[PULL 06/34] throttle-groups: fix memory leak in throttle_group_set_limit: |
Date: |
Mon, 6 Jan 2020 15:41:38 +0100 |
From: PanNengyuan <address@hidden>
This avoid a memory leak when qom-set is called to set throttle_group
limits, here is an easy way to reproduce:
1. run qemu-iotests as follow and check the result with asan:
./check -qcow2 184
Following is the asan output backtrack:
Direct leak of 912 byte(s) in 3 object(s) allocated from:
#0 0xffff8d7ab3c3 in __interceptor_calloc (/lib64/libasan.so.4+0xd33c3)
#1 0xffff8d4c31cb in g_malloc0 (/lib64/libglib-2.0.so.0+0x571cb)
#2 0x190c857 in qobject_input_start_struct
/mnt/sdc/qemu-master/qemu-4.2.0-rc0/qapi/qobject-input-visitor.c:295
#3 0x19070df in visit_start_struct
/mnt/sdc/qemu-master/qemu-4.2.0-rc0/qapi/qapi-visit-core.c:49
#4 0x1948b87 in visit_type_ThrottleLimits
qapi/qapi-visit-block-core.c:3759
#5 0x17e4aa3 in throttle_group_set_limits
/mnt/sdc/qemu-master/qemu-4.2.0-rc0/block/throttle-groups.c:900
#6 0x1650eff in object_property_set
/mnt/sdc/qemu-master/qemu-4.2.0-rc0/qom/object.c:1272
#7 0x1658517 in object_property_set_qobject
/mnt/sdc/qemu-master/qemu-4.2.0-rc0/qom/qom-qobject.c:26
#8 0x15880bb in qmp_qom_set
/mnt/sdc/qemu-master/qemu-4.2.0-rc0/qom/qom-qmp-cmds.c:74
#9 0x157e3e3 in qmp_marshal_qom_set qapi/qapi-commands-qom.c:154
Reported-by: Euler Robot <address@hidden>
Signed-off-by: PanNengyuan <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/throttle-groups.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index 77014c741b..37695b0cd7 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -893,8 +893,7 @@ static void throttle_group_set_limits(Object *obj, Visitor
*v,
{
ThrottleGroup *tg = THROTTLE_GROUP(obj);
ThrottleConfig cfg;
- ThrottleLimits arg = { 0 };
- ThrottleLimits *argp = &arg;
+ ThrottleLimits *argp;
Error *local_err = NULL;
visit_type_ThrottleLimits(v, name, &argp, &local_err);
@@ -912,6 +911,7 @@ static void throttle_group_set_limits(Object *obj, Visitor
*v,
unlock:
qemu_mutex_unlock(&tg->lock);
ret:
+ qapi_free_ThrottleLimits(argp);
error_propagate(errp, local_err);
return;
}
--
2.24.1
- [PULL 00/34] Block patches, Max Reitz, 2020/01/06
- [PULL 01/34] block: Add bdrv_qapi_perm_to_blk_perm(), Max Reitz, 2020/01/06
- [PULL 02/34] block: Use bdrv_qapi_perm_to_blk_perm(), Max Reitz, 2020/01/06
- [PULL 03/34] blkdebug: Allow taking/unsharing permissions, Max Reitz, 2020/01/06
- [PULL 04/34] iotests: Add @error to wait_until_completed, Max Reitz, 2020/01/06
- [PULL 05/34] iotests: Add test for failing mirror complete, Max Reitz, 2020/01/06
- [PULL 06/34] throttle-groups: fix memory leak in throttle_group_set_limit:,
Max Reitz <=
- [PULL 07/34] qcow2-bitmaps: fix qcow2_can_store_new_dirty_bitmap, Max Reitz, 2020/01/06
- [PULL 08/34] iotests: s/qocw2/qcow2/, Max Reitz, 2020/01/06
- [PULL 09/34] iotests/qcow2.py: Add dump-header-exts, Max Reitz, 2020/01/06
- [PULL 11/34] iotests: Add _filter_json_filename, Max Reitz, 2020/01/06
- [PULL 10/34] iotests/qcow2.py: Split feature fields into bits, Max Reitz, 2020/01/06
- [PULL 12/34] iotests: Filter refcount_order in 036, Max Reitz, 2020/01/06
- [PULL 13/34] iotests: Replace IMGOPTS by _unsupported_imgopts, Max Reitz, 2020/01/06
- [PULL 14/34] iotests: Drop compat=1.1 in 050, Max Reitz, 2020/01/06
- [PULL 15/34] iotests: Let _make_test_img parse its parameters, Max Reitz, 2020/01/06
- [PULL 16/34] iotests: Add -o and --no-opts to _make_test_img, Max Reitz, 2020/01/06