#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"));
}
/* 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.