Skip to content

Commit

Permalink
C: Dynamic PVOP strings
Browse files Browse the repository at this point in the history
OP_TRANS has no SvLEN, the op_pv is just freed.
  • Loading branch information
Reini Urban committed Feb 11, 2013
1 parent e39434d commit 6ea3f13
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/B/C.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1058,11 +1058,14 @@ sub B::PVOP::save {
my $sym = objsym($op);
return $sym if defined $sym;
$loopsect->comment("$opsect_common, pv");
$pvopsect->add( sprintf( "%s, %s", $op->_save_common, cstring( $op->pv ) ) );
# op_pv must be dynamic
$pvopsect->add( sprintf( "%s, NULL", $op->_save_common ) );
$pvopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
my $ix = $pvopsect->index;
$init->add( sprintf( "pvop_list[$ix].op_ppaddr = %s;", $op->ppaddr ) )
unless $B::C::optimize_ppaddr;
my $pv = pack "a*", $op->pv;
$init->add( sprintf( "pvop_list[$ix].op_pv = savepvn(%s, %u);", cstring( $pv ), length($pv) ) );
savesym( $op, "(OP*)&pvop_list[$ix]" );
}

Expand Down

0 comments on commit 6ea3f13

Please sign in to comment.