From a022ec53bdad139adcfb1fbd06ed7a5059bffbf4 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Thu, 31 Aug 2023 15:25:46 -0300 Subject: [PATCH] Fix memory leak with failed SQLPrepare Closes GH-12095 Signed-off-by: George Peter Banyard --- NEWS | 3 +++ ext/odbc/php_odbc.c | 1 + 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 05710a643eb..be860fb96d1 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ PHP NEWS . Fixed bug GH-10270 (Invalid error message when connection via SSL fails: "trying to connect via (null)"). (Kamil Tekiela) +- ODBC: + . Fixed memory leak with failed SQLPrepare. (NattyNarwhal) + - SPL: . Fixed bug GH-11972 (RecursiveCallbackFilterIterator regression in 8.1.18). (nielsdos) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index dd2bbd03e79..71fd3979002 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -923,6 +923,7 @@ PHP_FUNCTION(odbc_prepare) break; default: odbc_sql_error(conn, result->stmt, "SQLPrepare"); + efree(result); RETURN_FALSE; }