diff options
-rw-r--r-- | toke.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -660,17 +660,18 @@ Perl_lex_start(pTHX_ SV *line) #endif PL_lex_inwhat = 0; PL_sublex_info.sub_inwhat = 0; - PL_linestr = line; - s = SvPV_const(PL_linestr, len); - if (SvREADONLY(PL_linestr) || !len || s[len-1] != ';') { - PL_linestr = sv_2mortal(len ? newSVsv(PL_linestr) : newSVpvn(s, 0)); + s = SvPV_const(line, len); + if (SvREADONLY(line) || !len || s[len-1] != ';') { + PL_linestr = len ? newSVsv(line) : newSVpvn(s, 0); if (!len || s[len-1] != ';') sv_catpvs(PL_linestr, "\n;"); + } else { + SvTEMP_off(line); + SvREFCNT_inc_simple_void_NN(line); + PL_linestr = line; } - SvTEMP_off(PL_linestr); /* PL_linestr needs to survive until end of scope, not just the next FREETMPS. See changes 17505 and 17546 which fixed the symptoms only. */ - SvREFCNT_inc_simple_void_NN(PL_linestr); SAVEFREESV(PL_linestr); PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr); PL_bufend = PL_bufptr + SvCUR(PL_linestr); |