From 3b0f260b407a70e11d5dc5e41ecc53c4bfe4d4bd Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 4 Mar 2025 14:37:44 +0100 Subject: [PATCH] gcm: Properly clean up IV generator if crypter can't be created --- src/libstrongswan/plugins/gcm/gcm_aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstrongswan/plugins/gcm/gcm_aead.c b/src/libstrongswan/plugins/gcm/gcm_aead.c index f85e3167e7..edd224c039 100644 --- a/src/libstrongswan/plugins/gcm/gcm_aead.c +++ b/src/libstrongswan/plugins/gcm/gcm_aead.c @@ -368,7 +368,7 @@ METHOD(aead_t, set_key, bool, METHOD(aead_t, destroy, void, private_gcm_aead_t *this) { - this->crypter->destroy(this->crypter); + DESTROY_IF(this->crypter); this->iv_gen->destroy(this->iv_gen); memwipe(this->salt, sizeof(this->salt)); memwipe(this->h, sizeof(this->h)); @@ -440,7 +440,7 @@ gcm_aead_t *gcm_aead_create(encryption_algorithm_t algo, if (!this->crypter) { - free(this); + destroy(this); return NULL; } -- 2.47.2