Re: RFA: fix fopen related cleanups

Daniel Jacobowitz
2008-10-28T14:20:42Z

On Mon, Oct 27, 2008 at 07:27:43PM -0600, Tom Tromey wrote:
> While looking into another issue, I noticed a number of fopen-related
> buglets in gdb. In particular, there are several places in gdb where
> a file is not properly closed if an error occurs.
>
> This patch fixes all the fopen-related problems. It also fixes a
> couple memory leaks I noticed while writing this. Finally, it
> consolidates all the implementations of make_cleanup_fclose, explicit
> or implicit, into a single place.
>
> I think there are also some file-close-related flaws having to do with
> open (procfs_pidlist -- this function is flawed in a few ways) and
> also gdb_fopen (instances in dummy-frame.c, regcache.c, and
> reggroups.c according to my notes). I haven't yet checked opendir,
> socket, or pipe. I will deal with those in separate patches.
>
> Built and regtested on x86-64 (compile farm).
> Of course, this does not show whether the bug is fixed or not.
> For that I relied on inspection.
>
> Please review.

Looks OK to me.

--
Daniel Jacobowitz
CodeSourcery