Fix a core dump in lib/selfloader under -DDEBUGGING.
Spider.Boardman@Orb.Nashua.NH.US [Fri, 18 Aug 2000 18:41:14 +0000 (14:41 -0400)]
Subject: PATCH @6698 for [ID 20000817.007] Not OK: perl v5.7.0 +SUIDMAIL +DEVEL6676 on alpha-dec_osf 4.0f (UNINSTALLED)
Message-Id: <200008182241.SAA29667@Orb.Nashua.NH.US>

p4raw-id: //depot/perl@6709

regcomp.c

index d2195b0..c13eb26 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4372,8 +4372,13 @@ Perl_pregfree(pTHX_ struct regexp *r)
                    Perl_croak(aTHX_ "panic: pregfree comppad");
                old_comppad = PL_comppad;
                old_curpad = PL_curpad;
-               PL_comppad = new_comppad;
-               PL_curpad = AvARRAY(new_comppad);
+               /* Watch out for global destruction's random ordering. */
+               if (SvTYPE(new_comppad) == SVt_PVAV) {
+                   PL_comppad = new_comppad;
+                   PL_curpad = AvARRAY(new_comppad);
+               }
+               else
+                   PL_curpad = NULL;
                op_free((OP_4tree*)r->data->data[n]);
                PL_comppad = old_comppad;
                PL_curpad = old_curpad;