This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]