public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix coff_start_symtab resource leak found by Coverity
@ 2019-02-22 15:13 Gary Benson
  2019-02-22 17:04 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Benson @ 2019-02-22 15:13 UTC (permalink / raw)
  To: gdb-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix coff_start_symtab resource leak found by Coverity
  2019-02-22 15:13 [PATCH] Fix coff_start_symtab resource leak found by Coverity Gary Benson
@ 2019-02-22 17:04 ` Tom Tromey
  2019-03-01 14:10   ` Gary Benson
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2019-02-22 17:04 UTC (permalink / raw)
  To: Gary Benson; +Cc: gdb-patches

>>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:

Gary> Hi all,
Gary> This commit fixes a resource leak found by Coverity, where
Gary> coff_start_symtab performs an xstrdup that is now performed
Gary> within start_symtab by buildsym_compunit::buildsym_compunit.

Gary> Built and regtested on RHEL 7.6 x86_64.

Gary> Ok to commit?

Yes, thank you.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix coff_start_symtab resource leak found by Coverity
  2019-02-22 17:04 ` Tom Tromey
@ 2019-03-01 14:10   ` Gary Benson
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Benson @ 2019-03-01 14:10 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

Tom Tromey wrote:
> >>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
>
> Gary> Hi all,
> Gary> This commit fixes a resource leak found by Coverity, where
> Gary> coff_start_symtab performs an xstrdup that is now performed
> Gary> within start_symtab by buildsym_compunit::buildsym_compunit.
>
> Gary> Built and regtested on RHEL 7.6 x86_64.
>
> Gary> Ok to commit?
>
> Yes, thank you.

Thanks, I pushed it.

Cheers,
Gary

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-01 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 15:13 [PATCH] Fix coff_start_symtab resource leak found by Coverity Gary Benson
2019-02-22 17:04 ` Tom Tromey
2019-03-01 14:10   ` Gary Benson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).