aboutsummaryrefslogtreecommitdiff
path: root/gdb/fbsd-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/fbsd-nat.c')
-rw-r--r--gdb/fbsd-nat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 215d2a7..9fed5bf 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -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;
}