From 9fe4a2165de29f0802f0f9eb4801875e0f15c40a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 30 Oct 2008 18:42:28 +0000 Subject: * source.c (symtab_to_fullname): Test 'r >= 0'. (psymtab_to_fullname): Likewise. (get_filename_and_charpos): Make a cleanup. (forward_search_command): Likewise. (reverse_search_command): Likewise. * exec.c (exec_file_attach): Close scratch_chan on failure. * nto-procfs.c (procfs_open): Make a cleanup. (procfs_pidlist): Likewise. (do_closedir_cleanup): New function. --- gdb/exec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index 3b9ecfa..92450e6 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -217,8 +217,11 @@ exec_file_attach (char *filename, int from_tty) scratch_chan); if (!exec_bfd) - error (_("\"%s\": could not open as an executable file: %s"), - scratch_pathname, bfd_errmsg (bfd_get_error ())); + { + close (scratch_chan); + error (_("\"%s\": could not open as an executable file: %s"), + scratch_pathname, bfd_errmsg (bfd_get_error ())); + } /* At this point, scratch_pathname and exec_bfd->name both point to the same malloc'd string. However exec_close() will attempt to free it -- cgit v1.1