diff options
author | Tom Tromey <tromey@redhat.com> | 2008-10-28 15:22:13 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2008-10-28 15:22:13 +0000 |
commit | 7c8a8b0498cb16b1a36e3210977eae12cca98f64 (patch) | |
tree | 276b941fb714e325a2f0f9c2f3ec245e7208751f /gdb/source.c | |
parent | 0f3e7e3c00105f22f385228be5e5e9df2afe140c (diff) | |
download | gdb-7c8a8b0498cb16b1a36e3210977eae12cca98f64.zip gdb-7c8a8b0498cb16b1a36e3210977eae12cca98f64.tar.gz gdb-7c8a8b0498cb16b1a36e3210977eae12cca98f64.tar.bz2 |
* cli/cli-script.c (do_fclose_cleanup): Remove.
(script_from_file): Use make_cleanup_fclose.
* xml-tdesc.c (do_cleanup_fclose): Remove.
(fetch_xml_from_file): Use make_cleanup_fclose.
* tracepoint.c (tracepoint_save_command): Use
make_cleanup_fclose. Always free pathname.
* source.c (print_source_lines_base): Use make_cleanup_fclose.
* remote.c (fclose_cleanup): Remove.
(remote_file_put): Use make_cleanup_fclose.
(remote_file_get): Likewise.
* linux-nat.c (linux_nat_find_memory_regions): Use
make_cleanup_fclose.
(linux_nat_info_proc_cmd): Likewise.
(linux_proc_pending_signals): Likewise.
* fbsd-nat.c (fbsd_find_memory_regions): Use make_cleanup_fclose.
Free file name.
* cli/cli-dump.c (do_fclose_cleanup): Remove.
(make_cleanup_fclose): Remove.
* defs.h (make_cleanup_fclose): Declare.
* utils.c (do_fclose_cleanup): New function.
(make_cleanup_fclose): Likewise.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/source.c b/gdb/source.c index a5f434f..3ef557c 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1312,6 +1312,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, int noerror) int desc; FILE *stream; int nlines = stopline - line; + struct cleanup *cleanup; /* Regardless of whether we can open the file, set current_source_symtab. */ current_source_symtab = s; @@ -1378,6 +1379,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, int noerror) stream = fdopen (desc, FDOPEN_MODE); clearerr (stream); + cleanup = make_cleanup_fclose (stream); while (nlines-- > 0) { @@ -1417,7 +1419,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, int noerror) while (c != '\n' && (c = fgetc (stream)) >= 0); } - fclose (stream); + do_cleanups (cleanup); } /* Show source lines from the file of symtab S, starting with line |