]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
gcm: Properly clean up IV generator if crypter can't be created
authorTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 13:37:44 +0000 (14:37 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 13:37:44 +0000 (14:37 +0100)
src/libstrongswan/plugins/gcm/gcm_aead.c

index f85e3167e77fe27f6a5a6bae415d71ff49049042..edd224c03963cd486b990e0004625f0dbe9afe8f 100644 (file)
@@ -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;
        }