public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Michael Snyder <msnyder@vmware.com>
Cc: "binutils@sourceware.org" <binutils@sourceware.org>
Subject: Re: [RFA] dwarf.c (display_debug_frames): Free allocated memory.
Date: Fri, 25 Mar 2011 17:33:00 -0000	[thread overview]
Message-ID: <4D8CD21A.9060306@redhat.com> (raw)
In-Reply-To: <4D76A299.2030405@vmware.com>

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

      reply	other threads:[~2011-03-25 17:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 21:41 Michael Snyder
2011-03-25 17:33 ` Nick Clifton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D8CD21A.9060306@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=msnyder@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).