mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-18 10:58:43 -04:00
fixed memory leaks in GxsSecurity
This commit is contained in:
parent
70f72db0aa
commit
79779b8056
1 changed files with 3 additions and 0 deletions
|
@ -582,6 +582,8 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u
|
|||
// intialize context and send store encrypted cipher in ek
|
||||
if(!EVP_SealInit(ctx, EVP_aes_128_cbc(), &ek, &eklen, iv, &public_key, 1)) return false;
|
||||
|
||||
EVP_PKEY_free(public_key) ;
|
||||
|
||||
// now assign memory to out accounting for data, and cipher block size, key length, and key length val
|
||||
out = (uint8_t*)rs_malloc(inlen + cipher_block_size + size_net_ekl + eklen + EVP_MAX_IV_LENGTH) ;
|
||||
|
||||
|
@ -859,6 +861,7 @@ bool GxsSecurity::decrypt(uint8_t *& out, uint32_t & outlen, const uint8_t *in,
|
|||
std::cerr << "(EE) Cannot decrypt data. Most likely reason: private GXS key is missing." << std::endl;
|
||||
return false;
|
||||
}
|
||||
EVP_PKEY_free(privateKey) ;
|
||||
|
||||
if(inlen < (uint32_t)in_offset)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue