public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Duplicate DW_AT_call_file leak
@ 2023-03-27 11:29 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-03-27 11:29 UTC (permalink / raw)
  To: bfd-cvs

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:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-27 11:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 11:29 [binutils-gdb] Duplicate DW_AT_call_file leak Alan Modra

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).