[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/19] block/qcow2: do free crypto_opts in qcow2_close()
From: |
Max Reitz |
Subject: |
[PULL 08/19] block/qcow2: do free crypto_opts in qcow2_close() |
Date: |
Wed, 11 Mar 2020 14:52:02 +0100 |
From: Pan Nengyuan <address@hidden>
'crypto_opts' forgot to free in qcow2_close(), this patch fix the bellow leak
stack:
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7f0edd81f970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7f0edc6d149d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x55d7eaede63d in qobject_input_start_struct
/mnt/sdb/qemu-new/qemu_test/qemu/qapi/qobject-input-visitor.c:295
#3 0x55d7eaed78b8 in visit_start_struct
/mnt/sdb/qemu-new/qemu_test/qemu/qapi/qapi-visit-core.c:49
#4 0x55d7eaf5140b in visit_type_QCryptoBlockOpenOptions
qapi/qapi-visit-crypto.c:290
#5 0x55d7eae43af3 in block_crypto_open_opts_init
/mnt/sdb/qemu-new/qemu_test/qemu/block/crypto.c:163
#6 0x55d7eacd2924 in qcow2_update_options_prepare
/mnt/sdb/qemu-new/qemu_test/qemu/block/qcow2.c:1148
#7 0x55d7eacd33f7 in qcow2_update_options
/mnt/sdb/qemu-new/qemu_test/qemu/block/qcow2.c:1232
#8 0x55d7eacd9680 in qcow2_do_open
/mnt/sdb/qemu-new/qemu_test/qemu/block/qcow2.c:1512
#9 0x55d7eacdc55e in qcow2_open_entry
/mnt/sdb/qemu-new/qemu_test/qemu/block/qcow2.c:1792
#10 0x55d7eacdc8fe in qcow2_open
/mnt/sdb/qemu-new/qemu_test/qemu/block/qcow2.c:1819
#11 0x55d7eac3742d in bdrv_open_driver
/mnt/sdb/qemu-new/qemu_test/qemu/block.c:1317
#12 0x55d7eac3e990 in bdrv_open_common
/mnt/sdb/qemu-new/qemu_test/qemu/block.c:1575
#13 0x55d7eac4442c in bdrv_open_inherit
/mnt/sdb/qemu-new/qemu_test/qemu/block.c:3126
#14 0x55d7eac45c3f in bdrv_open
/mnt/sdb/qemu-new/qemu_test/qemu/block.c:3219
#15 0x55d7ead8e8a4 in blk_new_open
/mnt/sdb/qemu-new/qemu_test/qemu/block/block-backend.c:397
#16 0x55d7eacde74c in qcow2_co_create
/mnt/sdb/qemu-new/qemu_test/qemu/block/qcow2.c:3534
#17 0x55d7eacdfa6d in qcow2_co_create_opts
/mnt/sdb/qemu-new/qemu_test/qemu/block/qcow2.c:3668
#18 0x55d7eac1c678 in bdrv_create_co_entry
/mnt/sdb/qemu-new/qemu_test/qemu/block.c:485
#19 0x55d7eb0024d2 in coroutine_trampoline
/mnt/sdb/qemu-new/qemu_test/qemu/util/coroutine-ucontext.c:115
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Pan Nengyuan <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index f667349e50..d44b45633d 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2610,6 +2610,7 @@ static void qcow2_close(BlockDriverState *bs)
qcrypto_block_free(s->crypto);
s->crypto = NULL;
+ qapi_free_QCryptoBlockOpenOptions(s->crypto_opts);
g_free(s->unknown_header_fields);
cleanup_unknown_header_ext(bs);
--
2.24.1
- [PULL 00/19] Block patches, Max Reitz, 2020/03/11
- [PULL 01/19] luks: extract qcrypto_block_calculate_payload_offset(), Max Reitz, 2020/03/11
- [PULL 02/19] luks: implement .bdrv_measure(), Max Reitz, 2020/03/11
- [PULL 05/19] block/curl: HTTP header fields allow whitespace around values, Max Reitz, 2020/03/11
- [PULL 04/19] iotests: add 288 luks qemu-img measure test, Max Reitz, 2020/03/11
- [PULL 06/19] block/curl: HTTP header field names are case insensitive, Max Reitz, 2020/03/11
- [PULL 09/19] qemu-img: free memory before re-assign, Max Reitz, 2020/03/11
- [PULL 08/19] block/qcow2: do free crypto_opts in qcow2_close(),
Max Reitz <=
- [PULL 03/19] qemu-img: allow qemu-img measure --object without a filename, Max Reitz, 2020/03/11
- [PULL 10/19] block/qcow2-threads: fix qcow2_decompress, Max Reitz, 2020/03/11
- [PULL 07/19] iotests: Fix nonportable use of od --endian, Max Reitz, 2020/03/11
- [PULL 11/19] job: refactor progress to separate object, Max Reitz, 2020/03/11
- [PULL 12/19] block/block-copy: fix progress calculation, Max Reitz, 2020/03/11
- [PULL 13/19] block/block-copy: specialcase first copy_range request, Max Reitz, 2020/03/11
- [PULL 14/19] block/block-copy: use block_status, Max Reitz, 2020/03/11
- [PULL 15/19] block/block-copy: factor out find_conflicting_inflight_req, Max Reitz, 2020/03/11
- [PULL 16/19] block/block-copy: refactor interfaces to use bytes instead of end, Max Reitz, 2020/03/11
- [PULL 17/19] block/block-copy: rename start to offset in interfaces, Max Reitz, 2020/03/11