block: Avoid memleak on qcow2 image info failure
PATCH 1/1 block: Avoid memleak on qcow2 image info failure
If we fail to get bitmap info, we must not leak the encryption info.
--- block/qcow2.c | 1 + 1 file changed, 1 insertion(+)
block/qcow2.c +1 -0
@@ -4811,6 +4811,7 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs,if (local_err) {error_propagate (errp, local_err);qapi_free_ImageInfoSpecific (spec_info); +qapi_free_QCryptoBlockInfo (encrypt_info);return NULL ; } *spec_info->u.qcow2.data = (ImageInfoSpecificQCow2 ){
Signature · 1 line
2.25.1
Quoted 15 lines · Eric Blake
If we fail to get bitmap info, we must not leak the encryption info.
--- block/qcow2.c | 1 + 1 file changed, 1 insertion(+)block/qcow2.c +0
-0
block/qcow2.c static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs, · line 4817
Quoted 7 lines
block/qcow2.c +1
-0@@ -4811,6 +4811,7 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs,if (local_err) {error_propagate (errp, local_err);qapi_free_ImageInfoSpecific (spec_info); +qapi_free_QCryptoBlockInfo (encrypt_info);return NULL ; } *spec_info->u.qcow2.data = (ImageInfoSpecificQCow2 ){
Signature · 2 lines
Best regards, Vladimir
________________________________
From: Eric Blake <[email protected]>
Sent: Friday, March 20, 2020 9:36 PM
To: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>; Andrey Shinkevich <[email protected]>; Kevin Wolf <[email protected]>; Max Reitz <[email protected]>; open list:qcow2 <[email protected]>
Subject: [PATCH] block: Avoid memleak on qcow2 image info failure
If we fail to get bitmap info, we must not leak the encryption info.
---
Thank you Eric.
I have made a smoke test only without the crypto object instantiation.
Andrey
Max Reitz
AppliedQuoted 8 lines · Eric Blake
If we fail to get bitmap info, we must not leak the encryption info.
--- block/qcow2.c | 1 + 1 file changed, 1 insertion(+)
Thanks, applied to my block branch:
https://git.xanclic.moe/XanClic/qemu/commits/branch/block
Max