diff options
author | Nicolas R <atoomic@cpan.org> | 2020-08-14 16:16:22 -0500 |
---|---|---|
committer | ℕicolas ℝ <nicolas@atoomic.org> | 2020-08-21 08:54:54 -0600 |
commit | 042abef72d40ab7ff39127e2afae6e34dfc66404 (patch) | |
tree | 8dd0b970a29e16d5be7283db321ab8f068898ca5 /pp_ctl.c | |
parent | e04d927f2ca4d75153dd8737e2022c37fe5fa2d0 (diff) | |
download | perl-042abef72d40ab7ff39127e2afae6e34dfc66404.tar.gz |
die_unwind(): global destruction
Fix #18063
During global destruction make sure we preserve
the string by using mortalcopy.
This is an update on 8c86f0238ecb5f32c2e7fba36e3edfdb54069068
change which avoided sv_mortalcopy in favor of sv_2mortal.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1716,7 +1716,11 @@ Perl_die_unwind(pTHX_ SV *msv) * when unlocalising a tied var). So we do a dance with * mortalising and SAVEFREEing. */ - sv_2mortal(SvREFCNT_inc_simple_NN(exceptsv)); + if (PL_phase == PERL_PHASE_DESTRUCT) { + exceptsv = sv_mortalcopy(exceptsv); + } else { + exceptsv = sv_2mortal(SvREFCNT_inc_simple_NN(exceptsv)); + } /* * Historically, perl used to set ERRSV ($@) early in the die |