From d721f3c6b79e8c66499dbf3617867c6d74202830 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Fri, 27 Nov 2026 06:33:15 -0500 Subject: [PATCH] sapi/phpdbg: Fix btree cleanup skipping out-of-line branches phpdbg_btree_clean_recursive() never advanced past the first node of a contiguously allocated chain, so it only ever looked at that node's sibling. Siblings hanging off deeper nodes were leaked whenever a watchpoint tree still held entries at request shutdown, and a sibling on the first node, i.e. keys differing in the top bit, was freed once per remaining level. Step to the next node of the chain on every level. --- sapi/phpdbg/phpdbg_btree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sapi/phpdbg/phpdbg_btree.c b/sapi/phpdbg/phpdbg_btree.c index 788e9b464c14..4950809a4138 100644 --- a/sapi/phpdbg/phpdbg_btree.c +++ b/sapi/phpdbg/phpdbg_btree.c @@ -234,6 +234,7 @@ void phpdbg_btree_clean_recursive(phpdbg_btree_branch *branch, zend_ulong depth, if (branch->branches[use_branch]) { phpdbg_btree_clean_recursive(branch->branches[use_branch], depth, persistent); } + branch++; } pefree(start, persistent);