From: Dr. Stephen Henson Date: Mon, 9 Oct 2017 22:24:26 +0000 (+0100) Subject: Fix memory leak on lookup failure X-Git-Tag: OpenSSL_1_1_0g~40 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f042e93d82a71c6d996eb765263cda5199a67084;p=oweals%2Fopenssl.git Fix memory leak on lookup failure Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/4503) (cherry picked from commit 918a27facd3558444c69b1edbedb49478e82dff5) --- diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 877fbd072e..77e17dbd17 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -113,6 +113,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; }