Module: kamailio Branch: master Commit: 02c5f298d3355b7bb4c85bd290bc8265591f0ab8 URL: https://github.com/kamailio/kamailio/commit/02c5f298d3355b7bb4c85bd290bc8265...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-04-06T17:54:46+02:00
crypto: use same condition to free ttext.s on success or error
---
Modified: src/modules/crypto/crypto_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/02c5f298d3355b7bb4c85bd290bc8265... Patch: https://github.com/kamailio/kamailio/commit/02c5f298d3355b7bb4c85bd290bc8265...
---
diff --git a/src/modules/crypto/crypto_mod.c b/src/modules/crypto/crypto_mod.c index 955bf264bf..2099b25148 100644 --- a/src/modules/crypto/crypto_mod.c +++ b/src/modules/crypto/crypto_mod.c @@ -284,16 +284,18 @@ static int ki_crypto_aes_encrypt_helper(sip_msg_t* msg, str *ins, str *keys, val.flags = PV_VAL_STR; dst->setf(msg, &dst->pvp, (int)EQ_T, &val);
- free(etext.s); - if (! _crypto_key_derivation) + if (ttext.s != etext.s) { pkg_free(ttext.s); + } + free(etext.s); EVP_CIPHER_CTX_cleanup(en); EVP_CIPHER_CTX_free(en); return 1;
error: - if (ttext.s != etext.s) + if (ttext.s != etext.s) { pkg_free(ttext.s); + } error1: free(etext.s); EVP_CIPHER_CTX_cleanup(en);