Call EVP_CIPHER_CTX_cleanup to avoid leaking memory that was allocated in EVP_DecryptInit_ex

Also add matching cleanup to EVP_EncryptInit_ex for symmetry (though I'm not
convinced it actually leaks memory)

Change-Id: Icf72dd9e0295d8b6ea55909266a43e684b16420f
This commit is contained in:
Thurston Hou Yeen Dang 2016-07-18 14:16:37 -07:00
parent 848639bdfc
commit 06dc311817

View file

@ -1409,6 +1409,8 @@ static int encrypt_master_key(const char *passwd, const unsigned char *salt,
SLOGE("encrypt_master_key: crypto_scrypt failed");
}
EVP_CIPHER_CTX_cleanup(&e_ctx);
return 0;
}
@ -1458,6 +1460,8 @@ static int decrypt_master_key_aux(const char *passwd, unsigned char *salt,
}
}
EVP_CIPHER_CTX_cleanup(&d_ctx);
return 0;
}