PL_regex_padav elements hold either more AVs, or IVs that point to
Nicholas Clark [Mon, 23 May 2005 11:27:16 +0000 (11:27 +0000)]
regexps. Don't attempt to look at the IVX if it's not an IV.

p4raw-id: //depot/perl@24549

perl.c
sv.c

diff --git a/perl.c b/perl.c
index 4ebcefa..babaaed 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -539,7 +539,6 @@ perl_destruct(pTHXx)
 
         while (i) {
             SV *resv = ary[--i];
-            REGEXP *re = INT2PTR(REGEXP *,SvIVX(resv));
 
             if (SvFLAGS(resv) & SVf_BREAK) {
                 /* this is PL_reg_curpm, already freed
@@ -550,7 +549,8 @@ perl_destruct(pTHXx)
            else if(SvREPADTMP(resv)) {
              SvREPADTMP_off(resv);
            }
-            else {
+            else if(SvIOKp(resv)) {
+               REGEXP *re = INT2PTR(REGEXP *,SvIVX(resv));
                 ReREFCNT_dec(re);
             }
         }
diff --git a/sv.c b/sv.c
index 0a27714..8fe9be0 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1872,7 +1872,6 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt)
            AvALLOC(sv) = 0;
            AvARYLEN(sv)= 0;
            AvREAL_only(sv);
-           SvIVX(sv) = 0;
        }
        /* to here.  */
        /* XXX? Only SVt_NULL is ever upgraded to AV or HV?  */