Fix two errors in the OP debugging code. Now all test errors relate
authorNicholas Clark <nick@ccl4.org>
Thu, 12 Apr 2007 18:52:49 +0000 (18:52 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 12 Apr 2007 18:52:49 +0000 (18:52 +0000)
to newCONSTSUB().

p4raw-id: //depot/perl@30936

op.c
sv.c

diff --git a/op.c b/op.c
index e1b5ec5..5436a71 100644 (file)
--- a/op.c
+++ b/op.c
@@ -186,7 +186,6 @@ Perl_pending_Slabs_to_ro(pTHX) {
        read only. Also, do it ahead of the loop in case the warn triggers,
        and a warn handler has an eval */
 
-    free(PL_slabs);
     PL_slabs = NULL;
     PL_slab_count = 0;
 
@@ -194,13 +193,15 @@ Perl_pending_Slabs_to_ro(pTHX) {
     PL_OpSpace = 0;
 
     while (count--) {
-       const void *start = slabs[count];
+       void *const start = slabs[count];
        const size_t size = PERL_SLAB_SIZE* sizeof(I32*);
        if(mprotect(start, size, PROT_READ)) {
            Perl_warn(aTHX_ "mprotect for %p %lu failed with %d",
                      start, (unsigned long) size, errno);
        }
     }
+
+    free(slabs);
 }
 
 STATIC void
diff --git a/sv.c b/sv.c
index 5d84cb3..4ce7071 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -10932,6 +10932,10 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
        HINTS_REFCNT_UNLOCK;
     }
     PL_curcop          = (COP*)any_dup(proto_perl->Tcurcop, proto_perl);
+#ifdef PERL_DEBUG_READONLY_OPS
+    PL_slabs = NULL;
+    PL_slab_count = 0;
+#endif
 
     /* pseudo environmental stuff */
     PL_origargc                = proto_perl->Iorigargc;