Fortify memory debugging (cont'd). * src/base/ftdbgmem.c (FT_DumpMemory): Check for active debugger. (ft_mem_table_destroy): Move `FT_DumpMemory` call from here... (ft_mem_debug_done): ... to here.
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 5f1d20e..4f5c1e7 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -310,8 +310,6 @@
FT_Long leaks = 0;
- FT_DumpMemory( table->memory );
-
/* remove all blocks from the table, revealing leaked ones */
for ( i = 0; i < table->size; i++ )
{
@@ -862,6 +860,8 @@
FT_MemTable table = (FT_MemTable)memory->user;
+ FT_DumpMemory( memory );
+
ft_mem_table_destroy( table );
memory->free = table->free;
@@ -894,11 +894,9 @@
extern void
FT_DumpMemory( FT_Memory memory )
{
- FT_MemTable table = (FT_MemTable)memory->user;
-
-
- if ( table )
+ if ( memory->free == ft_mem_debug_free )
{
+ FT_MemTable table = (FT_MemTable)memory->user;
FT_MemSource* bucket = table->sources;
FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS;
FT_MemSource* sources;