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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user