Fix coff_start_symtab resource leak found by Coverity
authorGary Benson <gbenson@redhat.com>
Fri, 1 Mar 2019 13:50:27 +0000 (13:50 +0000)
committerGary Benson <gbenson@redhat.com>
Fri, 1 Mar 2019 13:50:27 +0000 (13:50 +0000)
This commit fixes a resource leak found by Coverity, where
coff_start_symtab performs an xstrdup that is now performed
within start_symtab by buildsym_compunit::buildsym_compunit.

gdb/ChangeLog:

* coffread.c (coff_start_symtab): Remove unnecessary xstrdup.

gdb/ChangeLog
gdb/coffread.c

index f7d86202494fd3b888f01e66b2d2e6673b86ebd4..da1890a32d582288701d53713d069063ae298e5e 100644 (file)
@@ -1,3 +1,7 @@
+2019-03-01  Gary Benson <gbenson@redhat.com>
+
+       * coffread.c (coff_start_symtab): Remove unnecessary xstrdup.
+
 2019-02-28  Brian Vandenberg  <phantall@gmail.com>
            Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
index 6381cd3f370978b7465d332cd44afade18654b16..91a112e190de1b02f847dd7aab6163ccf479b342 100644 (file)
@@ -385,10 +385,7 @@ coff_start_symtab (struct objfile *objfile, const char *name)
 {
   within_function = 0;
   start_symtab (objfile,
-  /* We fill in the filename later.  start_symtab puts this pointer
-     into last_source_file and we put it in subfiles->name, which
-     end_symtab frees; that's why it must be malloc'd.  */
-                xstrdup (name),
+               name,
   /* We never know the directory name for COFF.  */
                 NULL,
   /* The start address is irrelevant, since we call