From fefd015fc8da20cc1e26de042052ba62ac8bc583 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 25 Mar 2012 14:22:02 -0700 Subject: Copy the pv in parse_label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- toke.c | 9 +-------- 1 file changed, 1 insertion(+), 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(); -- cgit v1.2.1