mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
* 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.
This commit is contained in:
@@ -101,11 +101,14 @@ fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long,
|
||||
unsigned long start, end, size;
|
||||
char protection[4];
|
||||
int read, write, exec;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
mapfilename = xstrprintf ("/proc/%ld/map", (long) pid);
|
||||
cleanup = make_cleanup (xfree, mapfilename);
|
||||
mapfile = fopen (mapfilename, "r");
|
||||
if (mapfile == NULL)
|
||||
error (_("Couldn't open %s."), mapfilename);
|
||||
make_cleanup_fclose (mapfile);
|
||||
|
||||
if (info_verbose)
|
||||
fprintf_filtered (gdb_stdout,
|
||||
@@ -134,7 +137,7 @@ fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long,
|
||||
func (start, size, read, write, exec, obfd);
|
||||
}
|
||||
|
||||
fclose (mapfile);
|
||||
do_cleanups (cleanup);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user