Fix memory leak on php_odbc_fetch_hash() failure

The array is initialized but not freed.

Closes GH-18787.
This commit is contained in:
Niels Dossche 2025-06-07 00:33:34 +02:00
parent 9a9d98e02f
commit ef92e06de1
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
2 changed files with 4 additions and 0 deletions

3
NEWS
View file

@ -21,6 +21,9 @@ PHP NEWS
. Fix memory leak in intl_datetime_decompose() on failure. (nielsdos) . Fix memory leak in intl_datetime_decompose() on failure. (nielsdos)
. Fix memory leak in locale lookup on failure. (nielsdos) . Fix memory leak in locale lookup on failure. (nielsdos)
- ODBC:
. Fix memory leak on php_odbc_fetch_hash() failure. (nielsdos)
- OpenSSL: - OpenSSL:
. Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure. . Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure.
(nielsdos) (nielsdos)

View file

@ -1370,6 +1370,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
if (rc == SQL_ERROR) { if (rc == SQL_ERROR) {
odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
efree(buf); efree(buf);
zval_ptr_dtor(return_value);
RETURN_FALSE; RETURN_FALSE;
} }