From 7e4984d9ca73adf5eaecebbcfc9ba16224e862c7 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 9 Apr 2022 20:42:36 +0300 Subject: [PATCH] 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 --- src/crypto/crypto_openssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.2