Skip to content

ext/standard: Fix memory leak in get_meta_tags() on tag opened while expecting attribute - #25479

Closed
jorgsowa wants to merge 2 commits into
php:PHP-8.4from
jorgsowa:fix-get-meta-tags-leak-8.4
Closed

jorgsowa wants to merge 2 commits into
php:PHP-8.4from
jorgsowa:fix-get-meta-tags-leak-8.4

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

Fixed memory leak in get_meta_tags() when a tag opens while an attribute value is expected.

@jorgsowa jorgsowa self-assigned this Nov 16, 2026
@jorgsowa
jorgsowa requested a review from bukka as a code owner November 16, 2026 09:31
Comment thread ext/standard/file.c Outdated
Comment on lines +337 to +339
if (name) efree(name);
if (value) efree(value);
name = value = NULL;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: you could drop these three lines and instead make the TOK_CLOSETAG branch free on the pointers rather than on have_name/have_content. Same fix in one place, and it also covers any other path that clears the flags but keeps the buffers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I did it

@jorgsowa jorgsowa closed this in 0a11544 Nov 16, 2026
@jorgsowa jorgsowa changed the title ext/file: Fix memory leak in get_meta_tags() on tag opened while expecting attribute ext/standard: Fix memory leak in get_meta_tags() on tag opened while expecting attribute Nov 16, 2026
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