1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

pgsql: Fix memory leak when object init fails (#20387)

The return value is already overwritten by this point so we do have to
clean up the old return value (i.e. dataset) after all.
This commit is contained in:
Niels Dossche
2025-11-04 19:59:38 +01:00
committed by GitHub
parent 17f253a1f2
commit 04323955c1

View File

@@ -1875,6 +1875,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
ZVAL_COPY_VALUE(&dataset, return_value);
zend_result obj_initialized = object_init_ex(return_value, ce);
if (UNEXPECTED(obj_initialized == FAILURE)) {
zval_ptr_dtor(&dataset);
RETURN_THROWS();
}
if (!ce->default_properties_count && !ce->__set) {