From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: Duplicate DW_AT_call_file leak
Date: Mon, 27 Mar 2023 21:55:40 +1030 [thread overview]
Message-ID: <ZCF9NGTTWGGN5wkG@squeak.grove.modra.org> (raw)
From 10626d8e35a00e26dec4abb276052ed197545cc6 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Sun, 26 Mar 2023 18:49:13 +1030
Subject:
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 --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:
--
Alan Modra
Australia Development Lab, IBM
reply other threads:[~2023-03-27 11:25 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=ZCF9NGTTWGGN5wkG@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@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).