aboutsummaryrefslogtreecommitdiff
path: root/gdb/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/main.c')
-rw-r--r--gdb/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/main.c b/gdb/main.c
index 30e27c2..df4b111 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -545,7 +545,9 @@ captured_main_1 (struct captured_main_args *context)
#endif
/* Prefix warning messages with the command name. */
- warning_pre_print = xstrprintf ("%s: warning: ", gdb_program_name);
+ gdb::unique_xmalloc_ptr<char> tmp_warn_preprint
+ (xstrprintf ("%s: warning: ", gdb_program_name));
+ warning_pre_print = tmp_warn_preprint.get ();
if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
perror_warning_with_name (_("error finding working directory"));
@@ -972,7 +974,7 @@ captured_main_1 (struct captured_main_args *context)
}
/* Set off error and warning messages with a blank line. */
- xfree (warning_pre_print);
+ tmp_warn_preprint.reset ();
warning_pre_print = _("\nwarning: ");
/* Read and execute the system-wide gdbinit file, if it exists.