Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix coff_start_symtab resource leak found by Coverity
Date: Fri, 22 Feb 2019 15:13:00 -0000	[thread overview]
Message-ID: <1550848393-2743-1-git-send-email-gbenson@redhat.com> (raw)

Hi all,

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.

Built and regtested on RHEL 7.6 x86_64.

Ok to commit?

Thanks,
Gary

--
gdb/ChangeLog:

	* coffread.c (coff_start_symtab): Remove unnecessary xstrdup.
---
 gdb/ChangeLog  | 4 ++++
 gdb/coffread.c | 5 +----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/coffread.c b/gdb/coffread.c
index 6381cd3..91a112e 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -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
-- 
1.8.3.1


             reply	other threads:[~2019-02-22 15:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22 15:13 Gary Benson [this message]
2019-02-22 17:04 ` Tom Tromey
2019-03-01 14:10   ` Gary Benson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550848393-2743-1-git-send-email-gbenson@redhat.com \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox