[RFA] dwarf.c (display_debug_frames): Free allocated memory.

Nick Clifton nickc@redhat.com
Fri Mar 25 17:33:00 GMT 2011


Hi Michael,

> 2011-03-08  Michael Snyder<msnyder@vmware.com>
>
> 	* dwarf.c (display_debug_frames): Free allocated memory.

Sorry - this one is wrong:

> +	  free (fc);
>   	  fc = (Frame_Chunk *) xmalloc (sizeof (Frame_Chunk));

The chunk you are freeing here may be the statically allocated fde_fc 
chunk.  Plus these chunks are put on a chain which is walked by code 
later on in the function.

To free the memory you will have to wait to the end of the function and 
then walk the chain, freeing chunks as you go and watching out for the 
static chunk.  (Or else arrange for that chunk to be allocated as well).

Cheers
   Nick



More information about the Binutils mailing list