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] strings.c (print_strings): Plug memory leak.
Date: Tue, 08 Mar 2011 20:03:00 -0000	[thread overview]
Message-ID: <4D768B91.6090301@vmware.com> (raw)

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

OK?


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

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

	* strings.c (print_strings): Plug memory leak.

Index: strings.c
===================================================================
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.47
diff -u -p -r1.47 strings.c
--- strings.c	11 Nov 2009 04:54:32 -0000	1.47
+++ strings.c	8 Mar 2011 19:37:44 -0000
@@ -549,7 +549,10 @@ print_strings (const char *filename, FIL
 	{
 	  c = get_char (stream, &address, &magiccount, &magic);
 	  if (c == EOF)
-	    return;
+	    {
+	      free (buf);
+	      return;
+	    }
 	  if (! STRING_ISGRAPHIC (c))
 	    /* Found a non-graphic.  Try again starting with next char.  */
 	    goto tryline;
@@ -638,6 +641,7 @@ print_strings (const char *filename, FIL
 
       putchar ('\n');
     }
+  free (buf);
 }
 \f
 static void

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

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

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=4D768B91.6090301@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).