aboutsummaryrefslogtreecommitdiff
path: root/gdb/fbsd-tdep.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-03-05 15:02:45 -0800
committerJohn Baldwin <jhb@FreeBSD.org>2020-03-05 15:02:45 -0800
commit0afbabf05a1476244ef02407df531b6c7a4076dc (patch)
treecccdfb08b4bdb92b00d2a84063ed1523e6470226 /gdb/fbsd-tdep.c
parent3d1e5a43cbe1780ea66df0fe091998ee61177899 (diff)
downloadgdb-0afbabf05a1476244ef02407df531b6c7a4076dc.zip
gdb-0afbabf05a1476244ef02407df531b6c7a4076dc.tar.gz
gdb-0afbabf05a1476244ef02407df531b6c7a4076dc.tar.bz2
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.
Diffstat (limited to 'gdb/fbsd-tdep.c')
-rw-r--r--gdb/fbsd-tdep.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index bc1b5af..ffffb18 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -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. */