From: Nicholas Clark Date: Thu, 23 Jun 2005 10:41:00 +0000 (+0000) Subject: Re-initialise PL_curcop to &PL_compiling before destroying the optree. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=17fbfdf6c6f5ee46c01833862a16cddc094c4bd5;p=p5sagit%2Fp5-mst-13.2.git Re-initialise PL_curcop to &PL_compiling before destroying the optree. p4raw-id: //depot/perl@24952 --- diff --git a/perl.c b/perl.c index f8fd6d3..838f911 100644 --- a/perl.c +++ b/perl.c @@ -507,6 +507,11 @@ perl_destruct(pTHXx) /* We must account for everything. */ /* Destroy the main CV and syntax tree */ + /* Do this now, because destroying ops can cause new SVs to be generated + in Perl_pad_swipe, and when running with -DDEBUG_LEAKING_SCALARS they + PL_curcop to point to a valid op from which the filename structure + member is copied. */ + PL_curcop = &PL_compiling; if (PL_main_root) { /* ensure comppad/curpad to refer to main's pad */ if (CvPADLIST(PL_main_cv)) { @@ -515,7 +520,6 @@ perl_destruct(pTHXx) op_free(PL_main_root); PL_main_root = Nullop; } - PL_curcop = &PL_compiling; PL_main_start = Nullop; SvREFCNT_dec(PL_main_cv); PL_main_cv = Nullcv;