diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-26 18:49:13 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-03-27 21:58:46 +1030 |
commit | 92479281c4621e8d71565f76b879e36bf92b0b18 (patch) | |
tree | eb1fc0570f8ce53f909633bbdc33a9a899f64a72 /bfd | |
parent | 58c4c6a0bf29525a029d64a6446ac5d9e0c45a4a (diff) | |
download | gdb-92479281c4621e8d71565f76b879e36bf92b0b18.zip gdb-92479281c4621e8d71565f76b879e36bf92b0b18.tar.gz gdb-92479281c4621e8d71565f76b879e36bf92b0b18.tar.bz2 |
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.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/dwarf2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 15862dc..d99508a 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: |