diff options
author | Nicholas Clark <nick@ccl4.org> | 2013-02-28 15:12:47 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2013-03-06 10:03:13 +0100 |
commit | a420522db95b77620564c1be75cece4504eabef1 (patch) | |
tree | 098d005ce58a0a5d589c1851d3db759d49d80ff4 | |
parent | a5b310e3129d1a2cd55b8d79445eb65964c997d1 (diff) | |
download | perl-a420522db95b77620564c1be75cece4504eabef1.tar.gz |
Set PL_stderrgv to NULL if it is freed.
Without this, it's possible to hit assertion failures when global destruction
attempts to skip the PVIO for PL_stderrgv while cleaning up all objects.
-rw-r--r-- | sv.c | 2 | ||||
-rw-r--r-- | t/op/stash.t | 9 |
2 files changed, 10 insertions, 1 deletions
@@ -6257,6 +6257,8 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) PL_last_in_gv = NULL; else if ((const GV *)sv == PL_statgv) PL_statgv = NULL; + else if ((const GV *)sv == PL_stderrgv) + PL_stderrgv = NULL; case SVt_PVMG: case SVt_PVNV: case SVt_PVIV: diff --git a/t/op/stash.t b/t/op/stash.t index 616853b916..fd5450e40b 100644 --- a/t/op/stash.t +++ b/t/op/stash.t @@ -7,7 +7,7 @@ BEGIN { BEGIN { require "./test.pl"; } -plan( tests => 57 ); +plan( tests => 58 ); # Used to segfault (bug #15479) fresh_perl_like( @@ -63,6 +63,13 @@ package main; '', '', ); + # Variant of the above which creates an object that persists until global + # destruction. + fresh_perl_is( + 'use Exporter; package A; sub a { // }; %::=""', + '', + '', + ); } # now tests in eval |