From: Eric Blake Date: Fri, 20 Mar 2020 18:36:20 +0000 (-0500) Subject: block: Avoid memleak on qcow2 image info failure X-Git-Tag: v4.2.1~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=47e0fa74799c23dc29ff0adb356d82425b166231;p=thirdparty%2Fqemu.git block: Avoid memleak on qcow2 image info failure If we fail to get bitmap info, we must not leak the encryption info. Fixes: b8968c875f403 Fixes: Coverity CID 1421894 Signed-off-by: Eric Blake Message-Id: <20200320183620.1112123-1-eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Andrey Shinkevich Tested-by: Andrey Shinkevich Signed-off-by: Max Reitz (cherry picked from commit 71eaec2e8c7c8d266137b5c5f42da0bd6d6b5eb7) Signed-off-by: Michael Roth --- diff --git a/block/qcow2.c b/block/qcow2.c index 7c18721741e..13e118e16f0 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4800,6 +4800,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){