summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 98f2e5d2a6..36ba24a664 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2334,7 +2334,10 @@ S_return_lvalues(pTHX_ SV **mark, SV **sp, SV **newsp, I32 gimme,
SvREADONLY(TOPs) ? "readonly value" : "temporary");
}
else
- *++newsp = *MARK;
+ *++newsp =
+ SvTEMP(*MARK)
+ ? *MARK
+ : sv_2mortal(SvREFCNT_inc_simple_NN(*MARK));
}
}
PL_stack_sp = newsp;