From: Alan Modra Date: Sun, 26 Mar 2023 08:19:13 +0000 (+1030) Subject: Duplicate DW_AT_call_file leak X-Git-Tag: binutils-2_41~1195 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92479281c4621e8d71565f76b879e36bf92b0b18;p=thirdparty%2Fbinutils-gdb.git 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 --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: