This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] target.c/read_whatever_is_readable: fix memory leak
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 8 Mar 2011 08:58:14 +0400
- Subject: Re: [RFA] target.c/read_whatever_is_readable: fix memory leak
- References: <4D6ADE45.5040705@vmware.com>
> 2011-02-27 Michael Snyder <msnyder@vmware.com>
>
> * target.c (read_whatever_is_readable): Fix memory leak.
Looks correct to me.
> {
> - gdb_byte *buf = xmalloc (end-begin);
> + gdb_byte *buf = xmalloc (end - begin);
I applied this change myself (as well as a couple of other reformatting
changes), mostly because I have a fairly strong preference over
separating this type of change (reformatting - no code change) from
code changes. It simplifies our task if/when a revert is needed.
With git, there is a neat way to commit those changes separately
from your other changes: It's "git add -p" - it then asks you
hunk by hunk whether to put the change in the index or not (and
you and further divide hunks if necessary). Really useful in this
sort of situation.
--
Joel