public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] Duplicate DW_AT_call_file leak
Date: Mon, 27 Mar 2023 11:29:20 +0000 (GMT)	[thread overview]
Message-ID: <20230327112920.DB6D03858413@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=92479281c4621e8d71565f76b879e36bf92b0b18

commit 92479281c4621e8d71565f76b879e36bf92b0b18
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Mar 26 18:49:13 2023 +1030

    Duplicate DW_AT_call_file leak
    
    When given two or more DW_AT_call_file for a given function we
    currently leak the concat memory.
    
            * dwarf2.c (scan_unit_for_symbols): Don't leak on duplicate
            DW_AT_call_file.

Diff:
---
 bfd/dwarf2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 15862dc2037..d99508a96c7 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -4083,8 +4083,11 @@ scan_unit_for_symbols (struct comp_unit *unit)
 		{
 		case DW_AT_call_file:
 		  if (is_int_form (&attr))
-		    func->caller_file = concat_filename (unit->line_table,
-							 attr.u.val);
+		    {
+		      free (func->caller_file);
+		      func->caller_file = concat_filename (unit->line_table,
+							   attr.u.val);
+		    }
 		  break;
 
 		case DW_AT_call_line:

                 reply	other threads:[~2023-03-27 11:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230327112920.DB6D03858413@sourceware.org \
    --to=amodra@sourceware.org \
    --cc=bfd-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).