This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make debugging easier in memory allocator code in perl.c and util.c
[perl5.git] / perl.c
diff --git a/perl.c b/perl.c
index a5f1592..eb875fc 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -1364,8 +1364,11 @@ perl_free(pTHXx)
                            "free this thread's memory\n");
                PL_debug &= ~ DEBUG_m_FLAG;
            }
-           while(aTHXx->Imemory_debug_header.next != &(aTHXx->Imemory_debug_header))
-               safesysfree(PERL_MEMORY_DEBUG_HEADER_SIZE + (char *)(aTHXx->Imemory_debug_header.next));
+           while(aTHXx->Imemory_debug_header.next != &(aTHXx->Imemory_debug_header)){
+               char * next = (char *)(aTHXx->Imemory_debug_header.next);
+               Malloc_t ptr = PERL_MEMORY_DEBUG_HEADER_SIZE + next;
+               safesysfree(ptr);
+           }
            PL_debug = old_debug;
        }
     }