diff options
author | Nick Clifton <nickc@redhat.com> | 2011-03-25 17:09:08 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2011-03-25 17:09:08 +0000 |
commit | 68187828c0f44ea96953d5c79906cf438c701169 (patch) | |
tree | ec436b4d521e3bcea9c02eaa60d19f8088830200 /binutils/strings.c | |
parent | b42adabf1ef3955e838f78bf4575070b73d7b4ae (diff) | |
download | gdb-68187828c0f44ea96953d5c79906cf438c701169.zip gdb-68187828c0f44ea96953d5c79906cf438c701169.tar.gz gdb-68187828c0f44ea96953d5c79906cf438c701169.tar.bz2 |
* strings.c (print_strings): Plug memory leak.
Diffstat (limited to 'binutils/strings.c')
-rw-r--r-- | binutils/strings.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/binutils/strings.c b/binutils/strings.c index 00cfb6d..4763512 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -1,6 +1,6 @@ /* strings -- print the strings of printable characters in files Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -549,7 +549,10 @@ print_strings (const char *filename, FILE *stream, file_ptr address, { 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, FILE *stream, file_ptr address, putchar ('\n'); } + free (buf); } static void |