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.
This commit is contained in:
Werner Lemberg 2019-10-06 21:12:42 +02:00
parent d355a73aa3
commit 0fcf486e0d
3 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,13 @@
2019-10-06 Werner Lemberg <wl@gnu.org>
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 <wl@gnu.org>
* src/sfnt/sfwoff2 (reconstruct_font): Fix reallocation.

View File

@ -153,10 +153,10 @@ extern "C++"
(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 ) \

View File

@ -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,