Skip to content

ext/mbstring: mb_ereg*_replace fix leak on failed callback. #18646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2025

Conversation

devnexen
Copy link
Member

No description provided.

@@ -1109,6 +1109,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
} else {
if (!EG(exception)) {
Copy link
Member

Choose a reason for hiding this comment

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

I believe this code is even unreachable. zend_call_function only returns FAILURE when !EG(active), which should not be possible to hit from here. And retval is only UNDEF if an exception did happen.

Copy link
Member

Choose a reason for hiding this comment

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

After double checking I think I'm right. You can drop this else branch in master.

@devnexen devnexen force-pushed the onig_free_my_region branch from c8028af to d84273a Compare May 25, 2025 09:05
@devnexen devnexen changed the base branch from PHP-8.3 to master May 25, 2025 09:05
@devnexen devnexen merged commit 16e154a into php:master May 25, 2025
10 checks passed
@devnexen devnexen deleted the onig_free_my_region branch May 25, 2025 09:45
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