shithub: freetype+ttf2subf

Download patch

ref: c350aac0997d0ce0d8550dbd79bc8da644a4b163
parent: 63806aad9f348768654ac78751c7d0bc7aa77464
author: Alexei Podtelezhnikov <apodtele@gmail.com>
date: Wed Sep 8 08:18:23 EDT 2021

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.

git/fs: mount .git/fs: mount/attach disallowed
--- 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;