From 5b3fca71ae2013ecb997f9d71c3fc7dfdf69936d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 30 May 2013 16:24:36 +0000 Subject: some cleanup checker fixes Fix some bugs pointed out by the cleanup checker. This one just fixes some simple CLI reports, where CLI commands know that their caller will do cleanups. This an older style with few instances, so it is simpler to fix them up than to teach the checker about it. * cli/cli-cmds.c (cd_command, alias_command): Call do_cleanups. * cli/cli-dump.c (restore_binary_file): Call do_cleanups. * interps.c (interpreter_exec_cmd): Call do_cleanups. * source.c (show_substitute_path_command): Call do_cleanups. (unset_substitute_path_command, set_substitute_path_command): Likewise. * symfile.c (load_command): Call do_cleanups. --- gdb/cli/cli-dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gdb/cli/cli-dump.c') diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 529e0a0..208916c 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -508,6 +508,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args) static void restore_binary_file (char *filename, struct callback_data *data) { + struct cleanup *cleanup = make_cleanup (null_cleanup, NULL); FILE *file = fopen_with_cleanup (filename, FOPEN_RB); gdb_byte *buf; long len; @@ -553,7 +554,7 @@ restore_binary_file (char *filename, struct callback_data *data) len = target_write_memory (data->load_start + data->load_offset, buf, len); if (len != 0) warning (_("restore: memory write failed (%s)."), safe_strerror (len)); - return; + do_cleanups (cleanup); } static void -- cgit v1.1