diff options
author | Michael Snyder <msnyder@vmware.com> | 2011-03-08 18:58:54 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2011-03-08 18:58:54 +0000 |
commit | 13b3fd9b173983a3e86d98d988bf3a4b201b1583 (patch) | |
tree | f38e5c7a00a052acf1679fd24f3a2335567e0573 /gdb/target.c | |
parent | d3f323f3d2bff05029d582921b7f5df7c2bdfdbc (diff) | |
download | gdb-13b3fd9b173983a3e86d98d988bf3a4b201b1583.zip gdb-13b3fd9b173983a3e86d98d988bf3a4b201b1583.tar.gz gdb-13b3fd9b173983a3e86d98d988bf3a4b201b1583.tar.bz2 |
2011-02-27 Michael Snyder <msnyder@vmware.com>
* target.c (read_whatever_is_readable): Fix memory leak.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/target.c b/gdb/target.c index 0792707..aa59920 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; } |