In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/3d62d92055a4ab9a97fbb3cdf889c3c94b22b5a3?hp=1a3afb4f8c551b292b5b34f7244ed71f9ac01cfd>
- Log ----------------------------------------------------------------- commit 3d62d92055a4ab9a97fbb3cdf889c3c94b22b5a3 Author: David Mitchell <[email protected]> Date: Fri Feb 27 21:06:13 2015 +0000 fix to "fix op leak caused by OP_MULTIDEREF" Update to b7613b8a45c70113. Hugo pointed out that my for(; p; p = OpSIBLING(p)) op_free(p) loop relied on p->op_sibling still being valid after op_free(p). ----------------------------------------------------------------------- Summary of changes: op.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/op.c b/op.c index fdfac22..073cb1b 100644 --- a/op.c +++ b/op.c @@ -12613,7 +12613,7 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints) if (pass) { OP *mderef; - OP *p; + OP *p, *q; mderef = newUNOP_AUX(OP_MULTIDEREF, 0, NULL, arg_buf); if (index_skip == -1) { @@ -12778,8 +12778,11 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints) /* excise and free the original tree, and replace with * the multideref op */ p = op_sibling_splice(top_op, NULL, -1, mderef); - for(; p; p = OpSIBLING(p)) + while (p) { + q = OpSIBLING(p); op_free(p); + p = q; + } op_null(top_op); } else { -- Perl5 Master Repository
