Use std::string for 'psargs'.

fbsd_make_corefile_notes leaked the memory for psargs previously.

gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_make_corefile_notes): Use std::string for
	psargs.
This commit is contained in:
John Baldwin 2020-03-05 15:02:45 -08:00
parent 3d1e5a43cb
commit 0afbabf05a
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2020-03-05 John Baldwin <jhb@FreeBSD.org>
* fbsd-tdep.c (fbsd_make_corefile_notes): Use std::string for
psargs.
2020-03-05 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* .gitattributes: New file.

View File

@ -725,14 +725,14 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
if (get_exec_file (0))
{
const char *fname = lbasename (get_exec_file (0));
char *psargs = xstrdup (fname);
std::string psargs = fname;
if (get_inferior_args ())
psargs = reconcat (psargs, psargs, " ", get_inferior_args (),
(char *) NULL);
const char *infargs = get_inferior_args ();
if (infargs != NULL)
psargs = psargs + " " + infargs;
note_data = elfcore_write_prpsinfo (obfd, note_data, note_size,
fname, psargs);
fname, psargs.c_str ());
}
/* Thread register information. */