From d35bdfa8f28d646166592f607b8100b6c60be0f0 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 9 Oct 2025 22:50:01 +0200 Subject: [PATCH] openldap: fix memory-leak in error path The 'ber' pointer could escape a free if an early error occurred. Reported-by: Joshua Rogers Closes #18985 --- lib/openldap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/openldap.c b/lib/openldap.c index 72cfdc7039..92364e3e77 100644 --- a/lib/openldap.c +++ b/lib/openldap.c @@ -1216,7 +1216,6 @@ static CURLcode oldap_recv(struct Curl_easy *data, int sockindex, char *buf, break; } - ber_free(ber, 0); if(!result) result = client_write(data, STRCONST("\n"), NULL, 0, NULL, 0); @@ -1225,6 +1224,7 @@ static CURLcode oldap_recv(struct Curl_easy *data, int sockindex, char *buf, break; } + ber_free(ber, 0); ldap_msgfree(msg); return result; } -- 2.47.3