From 22f5b19d53c0ab8a90c6f41521d11b1f5fa04159 Mon Sep 17 00:00:00 2001 From: Nickolay Olshevsky Date: Mon, 21 Aug 2023 11:44:13 +0300 Subject: [PATCH] Do not double-destroy botan's crypto object. --- src/lib/crypto/symmetric.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/crypto/symmetric.cpp b/src/lib/crypto/symmetric.cpp index 195af3e190..cffbcad86e 100644 --- a/src/lib/crypto/symmetric.cpp +++ b/src/lib/crypto/symmetric.cpp @@ -613,7 +613,10 @@ pgp_cipher_aead_finish(pgp_crypt_t *crypt, uint8_t *out, const uint8_t *in, size void pgp_cipher_aead_destroy(pgp_crypt_t *crypt) { - botan_cipher_destroy(crypt->aead.obj); + if (crypt->aead.obj) { + botan_cipher_destroy(crypt->aead.obj); + } + memset(crypt, 0x0, sizeof(*crypt)); } size_t