From 918a27facd3558444c69b1edbedb49478e82dff5 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 9 Oct 2017 23:24:26 +0100 Subject: [PATCH] Fix memory leak on lookup failure Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/4503) --- crypto/evp/pmeth_lib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 31ec09261f..35e525b6ed 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -129,6 +129,9 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) pmeth = EVP_PKEY_meth_find(id); if (pmeth == NULL) { +#ifndef OPENSSL_NO_ENGINE + ENGINE_finish(e); +#endif EVPerr(EVP_F_INT_CTX_NEW, EVP_R_UNSUPPORTED_ALGORITHM); return NULL; } -- 2.25.1