SvFLAGS(PL_fdpid) |= SVTYPEMASK; /* don't clean out pid table now */
SvFLAGS(PL_strtab) |= SVTYPEMASK; /* don't clean out strtab now */
+ PL_comppad = Null(PAD*);
+ PL_curpad = Null(SV**);
+
/* the 2 is for PL_fdpid and PL_strtab */
while (PL_sv_count > 2 && sv_clean_all())
;
break;
case SAVEt_COMPPAD:
PL_comppad = (PAD*)SSPOPPTR;
- if (PL_comppad)
+ if (PL_comppad) {
PL_curpad = AvARRAY(PL_comppad);
+ SvREFCNT_dec(PL_comppad);
+ }
else
PL_curpad = Null(SV**);
break;
SSCHECK(2); \
SSPUSHPTR((SV*)PL_comppad); \
SSPUSHINT(SAVEt_COMPPAD); \
+ SvREFCNT_inc(PL_comppad); \
} STMT_END
#ifdef USE_ITHREADS
break;
case SAVEt_COMPPAD:
av = (AV*)POPPTR(ss,ix);
- TOPPTR(nss,ix) = av_dup(av, param);
+ TOPPTR(nss,ix) = av_dup_inc(av, param);
break;
case SAVEt_PADSV:
longval = (long)POPLONG(ss,ix);
use Config;
-print "1..185\n";
+print "1..186\n";
my $test = 1;
sub test (&) {
END { 1 while unlink $progfile }
}
+{
+ # bugid #24914 = used to coredump restoring PL_comppad in the
+ # savestack, due to the early freeing of the anon closure
+
+ my $got = runperl(stderr => 1, prog =>
+'sub d {die} my $f; $f = sub {my $x=1; $f = 0; d}; eval{$f->()}; print qw(ok)'
+ );
+ test { $got eq 'ok' };
+}
+
+
+