This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_magic_freearylen_p could coredump
authorDave Mitchell <davem@fdisolutions.com>
Tue, 14 Jun 2005 10:15:10 +0000 (10:15 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Tue, 14 Jun 2005 10:15:10 +0000 (10:15 +0000)
p4raw-id: //depot/perl@24833

mg.c

diff --git a/mg.c b/mg.c
index 4c01018..b2b0620 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1673,6 +1673,10 @@ Perl_magic_setarylen(pTHX_ SV *sv, MAGIC *mg)
 int
 Perl_magic_freearylen_p(pTHX_ SV *sv, MAGIC *mg)
 {
+    /* during global destruction, mg_obj may already have been freed */
+    if (PL_in_clean_all)
+       return;
+
     mg = mg_find (mg->mg_obj, PERL_MAGIC_arylen);
 
     if (mg) {