aboutsummaryrefslogtreecommitdiff
path: root/crypto/block-luks.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2018-12-07 19:13:47 +0300
committerDaniel P. Berrangé <berrange@redhat.com>2018-12-12 11:16:49 +0000
commitb640adca9f6a7f90b0975384b1264617ca8e0284 (patch)
treec015a4a3e8197e188ae7de400863cd3549aa7a87 /crypto/block-luks.c
parenta8b826d47adc5a62cf325482b6da1ba06d143df7 (diff)
downloadqemu-b640adca9f6a7f90b0975384b1264617ca8e0284.zip
qemu-b640adca9f6a7f90b0975384b1264617ca8e0284.tar.gz
qemu-b640adca9f6a7f90b0975384b1264617ca8e0284.tar.bz2
crypto/block-luks: fix memory leak in qcrypto_block_luks_create
Free block->cipher and block->ivgen on error path. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto/block-luks.c')
-rw-r--r--crypto/block-luks.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/block-luks.c b/crypto/block-luks.c
index 5738124..51e24d2 100644
--- a/crypto/block-luks.c
+++ b/crypto/block-luks.c
@@ -1341,6 +1341,9 @@ qcrypto_block_luks_create(QCryptoBlock *block,
qcrypto_ivgen_free(ivgen);
qcrypto_cipher_free(cipher);
+ qcrypto_cipher_free(block->cipher);
+ qcrypto_ivgen_free(block->ivgen);
+
g_free(luks);
return -1;
}