Skip to content

Commit 0432395

Browse files
authored
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.
1 parent 17f253a commit 0432395

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ext/pgsql/pgsql.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,6 +1875,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
18751875
ZVAL_COPY_VALUE(&dataset, return_value);
18761876
zend_result obj_initialized = object_init_ex(return_value, ce);
18771877
if (UNEXPECTED(obj_initialized == FAILURE)) {
1878+
zval_ptr_dtor(&dataset);
18781879
RETURN_THROWS();
18791880
}
18801881
if (!ce->default_properties_count && !ce->__set) {

0 commit comments

Comments
 (0)