Fix GH-21698: memory leak in ZipArchive::addGlob on early returns.#21702
Closed
devnexen wants to merge 2 commits intophp:PHP-8.4from
Closed
Fix GH-21698: memory leak in ZipArchive::addGlob on early returns.#21702devnexen wants to merge 2 commits intophp:PHP-8.4from
devnexen wants to merge 2 commits intophp:PHP-8.4from
Conversation
globfree was not called on the no-matches path and on the open_basedir reject path, leaking the glob_t contents populated by a successful glob() call.
ndossche
approved these changes
Apr 10, 2026
iliaal
added a commit
to iliaal/php-src
that referenced
this pull request
Apr 10, 2026
phpGH-21702 added two `globfree()` calls at the no-match and open_basedir reject paths, but called `globfree` directly instead of the `php_globfree` wrapper used at the success path below. On systems where `<glob.h>` isn't transitively included, the build breaks with `-Werror=implicit-function-declaration`. Match the existing wrapper usage at line 715.
iliaal
added a commit
to iliaal/php-src
that referenced
this pull request
Apr 10, 2026
phpGH-21702 added two `globfree()` calls at the no-match and open_basedir reject paths, but called `globfree` directly instead of the `php_globfree` wrapper used at the success path below. PHP-8.5 dropped the direct `<glob.h>` include from `ext/zip/php_zip.c` in favor of the `php_glob.h` wrapper, so the build now breaks with `-Werror=implicit-function-declaration` on systems where `<glob.h>` isn't transitively included. Match the existing wrapper usage at line 675.
devnexen
pushed a commit
that referenced
this pull request
Apr 10, 2026
GH-21702 added two `globfree()` calls at the no-match and open_basedir reject paths, but called `globfree` directly instead of the `php_globfree` wrapper used at the success path below. PHP-8.5 dropped the direct `<glob.h>` include from `ext/zip/php_zip.c` in favor of the `php_glob.h` wrapper, so the build now breaks with `-Werror=implicit-function-declaration` on systems where `<glob.h>` isn't transitively included. Match the existing wrapper usage at line 675. close GH-21709
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
globfree was not called on the no-matches path and on the open_basedir reject path, leaking the glob_t contents populated by a successful glob() call.