summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-06-23 10:41:00 +0000
committerNicholas Clark <nick@ccl4.org>2005-06-23 10:41:00 +0000
commit17fbfdf6c6f5ee46c01833862a16cddc094c4bd5 (patch)
treeb190c40ee312f29f1123af1c21df9c594ab55429 /perl.c
parent5fe61d939e01ff04c0119f3d65341fdc7d48769a (diff)
downloadperl-17fbfdf6c6f5ee46c01833862a16cddc094c4bd5.tar.gz
Re-initialise PL_curcop to &PL_compiling before destroying the optree.
p4raw-id: //depot/perl@24952
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/perl.c b/perl.c
index f8fd6d3e1e..838f911f4f 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;