public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: "binutils@sourceware.org" <binutils@sourceware.org>
Subject: [RFA/gas] dwarf2dbg.c, plug some memory leaks.
Date: Wed, 09 Mar 2011 20:52:00 -0000	[thread overview]
Message-ID: <4D77E86A.7030800@vmware.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 9 bytes --]

Review?


[-- Attachment #2: dwarf2dbg.txt --]
[-- Type: text/plain, Size: 1152 bytes --]

2011-03-09  Michael Snyder  <msnyder@vmware.com>

	* dwarf2dbg.c (out_file_list): Free malloced 'dir'.
	(out_debug_info): Free malloced 'dirname' and 'comp_dir'.

Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.108
diff -u -p -r1.108 dwarf2dbg.c
--- dwarf2dbg.c	28 Feb 2011 18:32:52 -0000	1.108
+++ dwarf2dbg.c	9 Mar 2011 20:48:30 -0000
@@ -1328,6 +1328,7 @@ out_file_list (void)
       size = strlen (dir) + 1;
       cp = frag_more (size);
       memcpy (cp, dir, size);
+      xfree ((char *) dir);
     }
   /* Terminate it.  */
   out_byte ('\0');
@@ -1684,6 +1685,7 @@ out_debug_info (segT info_seg, segT abbr
       memcpy (p, dirname, len);
       INSERT_DIR_SEPARATOR (p, len);
 #endif
+      xfree ((char *) dirname);
     }
   len = strlen (files[1].filename) + 1;
   p = frag_more (len);
@@ -1694,6 +1696,7 @@ out_debug_info (segT info_seg, segT abbr
   len = strlen (comp_dir) + 1;
   p = frag_more (len);
   memcpy (p, comp_dir, len);
+  xfree ((char *) comp_dir);
 
   /* DW_AT_producer */
   sprintf (producer, "GNU AS %s", VERSION);

             reply	other threads:[~2011-03-09 20:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09 20:52 Michael Snyder [this message]
2011-03-10  0:04 ` Richard Henderson
2011-03-10  0:55   ` Michael Snyder
2011-03-10  2:19 ` Hans-Peter Nilsson
2011-03-10 18:27   ` Michael Snyder

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=4D77E86A.7030800@vmware.com \
    --to=msnyder@vmware.com \
    --cc=binutils@sourceware.org \
    /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).