When opening the procfs map file, we create a cleanup routine to make
sure that the associated file descriptor gets closed, but we never
call the cleanup. So the FD gets leaked.
gdb/ChangeLog:
* procfs.c (iterate_over_mappings): Call do_cleanups before
returning.
+2011-11-10 Joel Brobecker <brobecker@adacore.com>
+
+ * procfs.c (iterate_over_mappings): Call do_cleanups before
+ returning.
+
2011-11-09 Doug Evans <dje@google.com>
* gdbtypes.c (check_typedef): Document that this function can
int funcstat;
int map_fd;
int nmap;
+ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
#ifdef NEW_PROC_API
struct stat sbuf;
#endif
for (prmap = prmaps; nmap > 0; prmap++, nmap--)
if ((funcstat = (*func) (prmap, child_func, data)) != 0)
- return funcstat;
+ {
+ do_cleanups (cleanups);
+ return funcstat;
+ }
+ do_cleanups (cleanups);
return 0;
}