From: Michael Snyder Date: Tue, 8 Mar 2011 18:58:54 +0000 (+0000) Subject: 2011-02-27 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=13b3fd9b173983a3e86d98d988bf3a4b201b1583;p=binutils-gdb.git 2011-02-27 Michael Snyder * target.c (read_whatever_is_readable): Fix memory leak. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2a1f02a887d..08bd2105c1b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ 2011-03-08 Michael Snyder + * target.c (read_whatever_is_readable): Fix memory leak. + * i386-tdep.c (i386_process_record): Document fall through. 2011-03-08 Jan Kratochvil diff --git a/gdb/target.c b/gdb/target.c index 0792707018c..aa5992048dd 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1968,7 +1968,10 @@ read_whatever_is_readable (struct target_ops *ops, /* If we previously failed to read 1 byte, nothing can be done here. */ if (end - begin <= 1) - return; + { + xfree (buf); + return; + } /* Check that either first or the last byte is readable, and give up if not. This heuristic is meant to permit reading accessible memory @@ -1987,6 +1990,7 @@ read_whatever_is_readable (struct target_ops *ops, } else { + xfree (buf); return; }