Commit 4d298d9e212 for php
commit 4d298d9e21243cf8d6c7fd4b865c07e57da51631
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date: Fri Nov 27 06:33:15 2026 -0500
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.
Closes GH-25835
diff --git a/sapi/phpdbg/phpdbg_btree.c b/sapi/phpdbg/phpdbg_btree.c
index 800039d3042..ef5ca645217 100644
--- a/sapi/phpdbg/phpdbg_btree.c
+++ b/sapi/phpdbg/phpdbg_btree.c
@@ -236,6 +236,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);