diff --git a/src/block_allocator.c b/src/block_allocator.c index 16700e6024911e94a40ab45d3b45630c5a3265c3..44ac0a5c51ee73efed51a6e8b130e4bc89356f97 100644 --- a/src/block_allocator.c +++ b/src/block_allocator.c @@ -535,6 +535,10 @@ void ba_walk(struct block_allocator * a, ba_walk_callback cb, void * data) { while(1) { if (free_block == NULL) { it.end = ((char*)BA_LASTBLOCK(it.l, p) + it.l.block_size); +#ifdef PIKE_DEBUG + if ((char*)it.end < (char*)it.cur) + Pike_fatal("Free list not sorted in ba_walk.\n"); +#endif if ((char*)it.end != (char*)it.cur) { cb(&it, data); } @@ -545,12 +549,12 @@ void ba_walk(struct block_allocator * a, ba_walk_callback cb, void * data) { } it.end = free_block; + free_block = free_block->next; + #ifdef PIKE_DEBUG - if (free_block >= free_block->next) + if ((char*)it.end < (char*)it.cur) Pike_fatal("Free list not sorted in ba_walk.\n"); #endif - free_block = free_block->next; - if ((char*)it.end != (char*)it.cur) cb(&it, data); diff --git a/src/las.c b/src/las.c index 4d3b1b1737981b8346df5d9192c00634f5099c58..104aa88a275f079843a8888f7065ff36187d9bcc 100644 --- a/src/las.c +++ b/src/las.c @@ -534,8 +534,12 @@ void free_all_nodes(void) #endif ba_walk(&Pike_compiler->node_allocator, &node_walker, NULL); #ifdef PIKE_DEBUG - if(!cumulative_parse_error) - Pike_fatal("Failed to free %"PRINTSIZET"d nodes when compiling!\n",e); + if(!cumulative_parse_error) { + size_t n, s; + ba_count_all(&Pike_compiler->node_allocator, &n, &s); + if (n) + Pike_fatal("Failed to free %"PRINTSIZET"d nodes when compiling!\n",n); + } #else } #endif