diff options
author | David Mitchell <davem@iabyn.com> | 2015-02-27 21:06:13 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2015-02-27 21:06:13 +0000 |
commit | 3d62d92055a4ab9a97fbb3cdf889c3c94b22b5a3 (patch) | |
tree | 2b69198e527b068ed7c81fa4a6788b6e55c3c3e1 /op.c | |
parent | 1a3afb4f8c551b292b5b34f7244ed71f9ac01cfd (diff) | |
download | perl-3d62d92055a4ab9a97fbb3cdf889c3c94b22b5a3.tar.gz |
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).
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 { |