From 3707c52ea7a184135ffb91007e0f7ec087b54dab Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 15 Jan 2022 23:21:11 -0500 Subject: [PATCH] lib/hcrypto: ENGINE_by_dso do not leak handle Must dlclose(handle) before returning even if 'engine' is returned to caller. Change-Id: I169044a768934e9b7774a323fe6c855fd07a09e4 --- lib/hcrypto/engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hcrypto/engine.c b/lib/hcrypto/engine.c index 9cea24821..1f062741f 100644 --- a/lib/hcrypto/engine.c +++ b/lib/hcrypto/engine.c @@ -349,12 +349,12 @@ ENGINE_by_dso(const char *path, const char *id) return NULL; } } + dlclose(handle); ENGINE_up_ref(engine); ret = add_engine(engine); if (ret != 1) { - dlclose(handle); ENGINE_finish(engine); return NULL; }