< prev index next >

src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c

Print this page


   1 /****************************************************************************
   2  *
   3  * ftdbgmem.c
   4  *
   5  *   Memory debugger (body).
   6  *
   7  * Copyright (C) 2001-2019 by
   8  * David Turner, Robert Wilhelm, and Werner Lemberg.
   9  *
  10  * This file is part of the FreeType project, and may only be used,
  11  * modified, and distributed under the terms of the FreeType project
  12  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
  13  * this file you indicate that you have read the license and
  14  * understand and accept it fully.
  15  *
  16  */
  17 
  18 
  19 #include <ft2build.h>
  20 #include FT_CONFIG_CONFIG_H
  21 #include FT_INTERNAL_DEBUG_H
  22 #include FT_INTERNAL_MEMORY_H
  23 #include FT_SYSTEM_H
  24 #include FT_ERRORS_H
  25 #include FT_TYPES_H
  26 
  27 


 604 
 605   static void
 606   ft_mem_table_remove( FT_MemTable  table,
 607                        FT_Byte*     address,
 608                        FT_Long      delta )
 609   {
 610     if ( table )
 611     {
 612       FT_MemNode  *pnode, node;
 613 
 614 
 615       pnode = ft_mem_table_get_nodep( table, address );
 616       node  = *pnode;
 617       if ( node )
 618       {
 619         FT_MemSource  source;
 620 
 621 
 622         if ( node->size < 0 )
 623           ft_mem_debug_panic(
 624             "freeing memory block at %p more than once at (%s:%ld)\n"
 625             "block allocated at (%s:%ld) and released at (%s:%ld)",


 626             address,
 627             FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
 628             FT_FILENAME( node->source->file_name ), node->source->line_no,
 629             FT_FILENAME( node->free_file_name ), node->free_line_no );
 630 
 631         /* scramble the node's content for additional safety */
 632         FT_MEM_SET( address, 0xF3, node->size );
 633 
 634         if ( delta == 0 )
 635         {
 636           source = node->source;
 637 
 638           source->cur_blocks--;
 639           source->cur_size -= node->size;
 640 
 641           table->alloc_current -= node->size;
 642         }
 643 
 644         if ( table->keep_alive )
 645         {


   1 /****************************************************************************
   2  *
   3  * ftdbgmem.c
   4  *
   5  *   Memory debugger (body).
   6  *
   7  * Copyright (C) 2001-2020 by
   8  * David Turner, Robert Wilhelm, and Werner Lemberg.
   9  *
  10  * This file is part of the FreeType project, and may only be used,
  11  * modified, and distributed under the terms of the FreeType project
  12  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
  13  * this file you indicate that you have read the license and
  14  * understand and accept it fully.
  15  *
  16  */
  17 
  18 
  19 #include <ft2build.h>
  20 #include FT_CONFIG_CONFIG_H
  21 #include FT_INTERNAL_DEBUG_H
  22 #include FT_INTERNAL_MEMORY_H
  23 #include FT_SYSTEM_H
  24 #include FT_ERRORS_H
  25 #include FT_TYPES_H
  26 
  27 


 604 
 605   static void
 606   ft_mem_table_remove( FT_MemTable  table,
 607                        FT_Byte*     address,
 608                        FT_Long      delta )
 609   {
 610     if ( table )
 611     {
 612       FT_MemNode  *pnode, node;
 613 
 614 
 615       pnode = ft_mem_table_get_nodep( table, address );
 616       node  = *pnode;
 617       if ( node )
 618       {
 619         FT_MemSource  source;
 620 
 621 
 622         if ( node->size < 0 )
 623           ft_mem_debug_panic(
 624             "freeing memory block at %p more than once\n"
 625             "  at (%s:%ld)!\n"
 626             "  Block was allocated at (%s:%ld)\n"
 627             "  and released at (%s:%ld).",
 628             address,
 629             FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
 630             FT_FILENAME( node->source->file_name ), node->source->line_no,
 631             FT_FILENAME( node->free_file_name ), node->free_line_no );
 632 
 633         /* scramble the node's content for additional safety */
 634         FT_MEM_SET( address, 0xF3, node->size );
 635 
 636         if ( delta == 0 )
 637         {
 638           source = node->source;
 639 
 640           source->cur_blocks--;
 641           source->cur_size -= node->size;
 642 
 643           table->alloc_current -= node->size;
 644         }
 645 
 646         if ( table->keep_alive )
 647         {


< prev index next >