Module: kamailio Branch: master Commit: ff2d63b228fe58f065c4302328f79c579aab5676 URL: https://github.com/kamailio/kamailio/commit/ff2d63b228fe58f065c4302328f79c579aab5676
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-06-22T17:29:11+02:00 crypto: free contexts in case of errors --- Modified: src/modules/crypto/crypto_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/ff2d63b228fe58f065c4302328f79c579aab5676.diff Patch: https://github.com/kamailio/kamailio/commit/ff2d63b228fe58f065c4302328f79c579aab5676.patch --- diff --git a/src/modules/crypto/crypto_mod.c b/src/modules/crypto/crypto_mod.c index 985501b2c1c..c4fed57d511 100644 --- a/src/modules/crypto/crypto_mod.c +++ b/src/modules/crypto/crypto_mod.c @@ -199,6 +199,7 @@ static int ki_crypto_aes_encrypt_helper( LM_ERR("base64 key input has wrong length %d, only supports 128 " "or 256 bit keys\n", lkey.len); + EVP_CIPHER_CTX_free(en); return -1; } lkey.s = (char *)decoded_key; @@ -215,12 +216,14 @@ static int ki_crypto_aes_encrypt_helper( "%d, needs to be " "16 bytes\n", iv.len); + EVP_CIPHER_CTX_free(en); return -1; } iv.s = (char *)decoded_iv; } else { /* random IV */ if(RAND_bytes(tmpiv, sizeof(tmpiv)) != 1) { LM_ERR("could not set initialization vector\n"); + EVP_CIPHER_CTX_free(en); return -1; } iv.s = (char *)tmpiv; @@ -492,6 +495,7 @@ static int ki_crypto_aes_decrypt_helper( LM_ERR("base64 key input has wrong length %d, only 128 or 256 " " bit keys are supported\n", lkey.len); + EVP_CIPHER_CTX_free(de); return -1; } lkey.s = (char *)decoded_key; _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
