summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-03-25 14:22:02 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-03-25 14:25:55 -0700
commitfefd015fc8da20cc1e26de042052ba62ac8bc583 (patch)
tree9d1d773745d5ee49e293b928bef8a991be51c2f2
parentf232b41c679f24b875f6f23a4abe659b0c946942 (diff)
downloadperl-fefd015fc8da20cc1e26de042052ba62ac8bc583.tar.gz
Copy the pv in parse_label
Two commits ago, the label-handling code in the tokenizer was changed to record the label in an SVOP instead of just a plain unclaimed PV. Likewise, the parser (perly.y) was changed to copy the string out of the SVOP’s SV, insteading of taking ownership of the existing PV. parse_label was modified to take the string out of the SVOP, but was not copying it like perly.y. So it resulted in this: $ PERL_DESTRUCT_LEVEL=2 ./perl -Ilib ext/XS-APItest/t/swaplabel.t 1..56 ok 1 ... truncated ... ok 56 panic: free from wrong pool during global destruction.
-rw-r--r--toke.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/toke.c b/toke.c
index 975790a360..1d1855048b 100644
--- a/toke.c
+++ b/toke.c
@@ -11508,17 +11508,10 @@ Perl_parse_label(pTHX_ U32 flags)
if (PL_lex_state == LEX_KNOWNEXT) {
PL_parser->yychar = yylex();
if (PL_parser->yychar == LABEL) {
- STRLEN llen;
- char *lpv = SvPV(cSVOPx(pl_yylval.opval)->op_sv, llen);
SV *lsv;
PL_parser->yychar = YYEMPTY;
lsv = newSV_type(SVt_PV);
- SvPV_set(lsv, lpv);
- SvCUR_set(lsv, llen);
- SvLEN_set(lsv, llen+1);
- SvPOK_on(lsv);
- if (SvUTF8(cSVOPx(pl_yylval.opval)->op_sv))
- SvUTF8_on(lsv);
+ sv_copypv(lsv, cSVOPx(pl_yylval.opval)->op_sv);
return lsv;
} else {
yyunlex();