[php-src] PR #22805: Free pending named positions on partial-argument compile errors
| From: | iliaal | Date: | Sun, 19 Jul 2026 14:28:52 +0000 |
| Subject: | [php-src] PR #22805: Free pending named positions on partial-argument compile errors | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37152@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22805
Author: iliaal
A partial application that uses a named placeholder (
foo(x: ?, ...)) lazily allocates a
named-positions table in zend_compile_args_ex, consumed only after argument compilation
succeeds. A following argument that is itself a compile error (a positional or unpack after the
named placeholder, or a misplaced variadic placeholder) longjmps out of the function
before the table is consumed and leaks it.
This frees the table before the four reachable errors. The leak is on a zend_bailout
path, so ZEND_MM's leak reporter never sees it; it shows only under valgrind/ASAN. Verified
with USE_ZEND_ALLOC=0 valgrind: 376 bytes to 0 on foo(x: ?, ?), and 0 on
the unpack, named-after-variadic, and variadic-twice variants. The added test exercises the path for
CI valgrind; the error output is identical before and after, so it is a path check, not an output
red/green.