[RFA] target.c/read_whatever_is_readable: fix memory leak

Joel Brobecker brobecker@adacore.com
Tue Mar 8 05:13:00 GMT 2011


> 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



More information about the Gdb-patches mailing list