Fix memory leak in phpdbg calling registered function

Closes GH-17635.
This commit is contained in:
ndossche 2025-01-30 10:30:25 +01:00 committed by Niels Dossche
parent 5447473785
commit 62bbfdebaa
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
3 changed files with 28 additions and 0 deletions

View file

@ -189,6 +189,9 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
zval_ptr_dtor_str(&fci.function_name);
efree(lc_name);
if (fci.named_params) {
zend_array_destroy(fci.named_params);
}
return SUCCESS;
}

View file

@ -0,0 +1,24 @@
--TEST--
registering a function and calling it leaks arguments memory
--FILE--
<?php
echo "Done\n";
?>
--PHPDBG--
register var_dump
var_dump "a" "b"
register flush
flush
r
q
--EXPECTF--
[Successful compilation of %s]
prompt> [Registered var_dump]
prompt> string(1) "a"
string(1) "b"
prompt> [Registered flush]
prompt>
prompt> Done
[Script ended normally]
prompt>