From: Jouni Malinen Date: Sat, 9 Apr 2022 17:42:36 +0000 (+0300) Subject: OpenSSL: Use a correct EVP_CIPHER_CTX freeing function on an error path X-Git-Tag: hostap_2_11~2088 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e4984d9ca73adf5eaecebbcfc9ba16224e862c7;p=thirdparty%2Fhostap.git OpenSSL: Use a correct EVP_CIPHER_CTX freeing function on an error path aes_encrypt_init() used incorrect function to free the EVP_CIPHER_CTX allocated within this function. Fix that to use the OpenSSL function for freeing the context. Signed-off-by: Jouni Malinen --- diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c index 4b4b57d07..1795c73f9 100644 --- a/src/crypto/crypto_openssl.c +++ b/src/crypto/crypto_openssl.c @@ -412,7 +412,7 @@ void * aes_encrypt_init(const u8 *key, size_t len) if (ctx == NULL) return NULL; if (EVP_EncryptInit_ex(ctx, type, NULL, key, NULL) != 1) { - os_free(ctx); + EVP_CIPHER_CTX_free(ctx); return NULL; } EVP_CIPHER_CTX_set_padding(ctx, 0);