]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use std::string for 'psargs'.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 5 Mar 2020 23:02:45 +0000 (15:02 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 5 Mar 2020 23:02:45 +0000 (15:02 -0800)
fbsd_make_corefile_notes leaked the memory for psargs previously.

gdb/ChangeLog:

* fbsd-tdep.c (fbsd_make_corefile_notes): Use std::string for
psargs.

gdb/ChangeLog
gdb/fbsd-tdep.c

index d8c44d80e4e5623643b81fe1233ee318c3acfe84..ee0d10d8c98c40a2cc8f88b2cf01c8cc3e13996b 100644 (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.
index bc1b5afd020cb3e70bc81dfad093f227cca0c3b4..ffffb187008b8fcfbd207bf84079e526995ed38f 100644 (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.  */