Skip to content

ext/session: fix missing zval_ptr_dtor for retval in PS_GC_FUNC(user)#21747

Open
jorgsowa wants to merge 1 commit intophp:PHP-8.4from
jorgsowa:fix/session-gc-retval-leak
Open

ext/session: fix missing zval_ptr_dtor for retval in PS_GC_FUNC(user)#21747
jorgsowa wants to merge 1 commit intophp:PHP-8.4from
jorgsowa:fix/session-gc-retval-leak

Conversation

@jorgsowa
Copy link
Copy Markdown
Contributor

PS_GC_FUNC(user) did not call zval_ptr_dtor() on the return value of the user GC callback, leaking memory when the callback returned a reference-counted value. All other user handlers (write, destroy, validate_sid, update_timestamp) already free retval correctly.

Copy link
Copy Markdown
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be backported to 8.4.

PS_GC_FUNC(user) did not call zval_ptr_dtor() on the return value of
the user GC callback, leaking memory when the callback returned a
reference-counted value. All other user handlers (write, destroy,
validate_sid, update_timestamp) already free retval correctly.
@jorgsowa jorgsowa force-pushed the fix/session-gc-retval-leak branch from 1c709a2 to 2330863 Compare April 15, 2026 08:39
@jorgsowa jorgsowa changed the base branch from master to PHP-8.4 April 15, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants