ref: 0fcf486e0d6f3bb1cb17b6a6f00f651e21077dda
parent: d355a73aa3821ae83e0e28e0888eb22dd83b2d96
author: Werner Lemberg <[email protected]>
date: Sun Oct 6 17:12:42 EDT 2019
Improve memory debugging. * include/freetype/internal/ftmemory.h (FT_MEM_FREE): Use `FT_DEBUG_INNER' to set source code file name and line. * src/base/ftdbgmem.c (ft_mem_table_remove): Better formatting of tracing message.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-10-06 Werner Lemberg <[email protected]>
+
+ Improve memory debugging.
+
+ * include/freetype/internal/ftmemory.h (FT_MEM_FREE): Use
+ `FT_DEBUG_INNER' to set source code file name and line.
+
+ * src/base/ftdbgmem.c (ft_mem_table_remove): Better formatting of
+ tracing message.
+
2019-10-03 Werner Lemberg <[email protected]>
* src/sfnt/sfwoff2 (reconstruct_font): Fix reallocation.
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -153,10 +153,10 @@
(FT_Long)(size), \
&error ) )
-#define FT_MEM_FREE( ptr ) \
- FT_BEGIN_STMNT \
- ft_mem_free( memory, (ptr) ); \
- (ptr) = NULL; \
+#define FT_MEM_FREE( ptr ) \
+ FT_BEGIN_STMNT \
+ FT_DEBUG_INNER( ft_mem_free( memory, (ptr) ) ); \
+ (ptr) = NULL; \
FT_END_STMNT
#define FT_MEM_NEW( ptr ) \
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -621,8 +621,10 @@
if ( node->size < 0 )
ft_mem_debug_panic(
- "freeing memory block at %p more than once at (%s:%ld)\n"
- "block allocated at (%s:%ld) and released at (%s:%ld)",
+ "freeing memory block at %p more than once\n"
+ " at (%s:%ld)!\n"
+ " Block was allocated at (%s:%ld)\n"
+ " and released at (%s:%ld).",
address,
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
FT_FILENAME( node->source->file_name ), node->source->line_no,