diff options
author | Richard Huveneers <[email protected]> | 2020-06-18 19:52:09 +0200 |
---|---|---|
committer | Richard Huveneers <[email protected]> | 2020-06-18 19:52:09 +0200 |
commit | 4bbb455be91187ade950c7d95f0044a27c1f891e (patch) | |
tree | e7bece4cb6614dd6ba01b2925939d157879f55c2 /src/lib | |
parent | a5cb4c5c3b47c30a437259fb3060623a70ca9fc4 (diff) |
Fix memory leak
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/prov/commoncrypto/commoncrypto_block.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/prov/commoncrypto/commoncrypto_block.cpp b/src/lib/prov/commoncrypto/commoncrypto_block.cpp index a6632ba53..417e765bd 100644 --- a/src/lib/prov/commoncrypto/commoncrypto_block.cpp +++ b/src/lib/prov/commoncrypto/commoncrypto_block.cpp @@ -97,6 +97,7 @@ void CommonCrypto_BlockCipher::key_schedule(const uint8_t key[], size_t length) { secure_vector<uint8_t> full_key(key, key + length); + clear(); commoncrypto_adjust_key_size(key, length, m_opts, full_key); CCCryptorStatus status; @@ -130,6 +131,18 @@ BlockCipher* CommonCrypto_BlockCipher::clone() const void CommonCrypto_BlockCipher::clear() { m_key_set = false; + + if(m_encrypt) + { + CCCryptorRelease(m_encrypt); + m_encrypt = nullptr; + } + + if(m_decrypt) + { + CCCryptorRelease(m_decrypt); + m_decrypt = nullptr; + } } } |