]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block: Avoid memleak on qcow2 image info failure
authorEric Blake <eblake@redhat.com>
Fri, 20 Mar 2020 18:36:20 +0000 (13:36 -0500)
committerMax Reitz <mreitz@redhat.com>
Tue, 24 Mar 2020 10:41:46 +0000 (11:41 +0100)
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 <eblake@redhat.com>
Message-Id: <20200320183620.1112123-1-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Tested-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2.c

index d44b45633dbbceebb224395131609abb3adec169..e08917ed84623291385ddb083818c17d07f7f298 100644 (file)
@@ -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){