summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--op.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/op.c b/op.c
index 2ffe10fa23..86ec54ed80 100644
--- a/op.c
+++ b/op.c
@@ -1496,14 +1496,17 @@ the tree thread-safe.
void
Perl_finalize_optree(pTHX_ OP* o)
{
+ I32 i = PL_savestack_ix;
PERL_ARGS_ASSERT_FINALIZE_OPTREE;
+ if (o != PL_main_root) SAVEFREEOP(o);
ENTER;
SAVEVPTR(PL_curcop);
finalize_op(o);
LEAVE;
+ PL_savestack_ix = i;
}
STATIC void