summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-02-27 21:06:13 +0000
committerDavid Mitchell <davem@iabyn.com>2015-02-27 21:06:13 +0000
commit3d62d92055a4ab9a97fbb3cdf889c3c94b22b5a3 (patch)
tree2b69198e527b068ed7c81fa4a6788b6e55c3c3e1 /op.c
parent1a3afb4f8c551b292b5b34f7244ed71f9ac01cfd (diff)
downloadperl-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.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/op.c b/op.c
index fdfac220b7..073cb1bfdc 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 {