From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id DB6D03858413; Mon, 27 Mar 2023 11:29:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB6D03858413 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Duplicate DW_AT_call_file leak X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 58c4c6a0bf29525a029d64a6446ac5d9e0c45a4a X-Git-Newrev: 92479281c4621e8d71565f76b879e36bf92b0b18 Message-Id: <20230327112920.DB6D03858413@sourceware.org> Date: Mon, 27 Mar 2023 11:29:20 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2023 11:29:21 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D92479281c462= 1e8d71565f76b879e36bf92b0b18 commit 92479281c4621e8d71565f76b879e36bf92b0b18 Author: Alan Modra Date: Sun Mar 26 18:49:13 2023 +1030 Duplicate DW_AT_call_file leak =20 When given two or more DW_AT_call_file for a given function we currently leak the concat memory. =20 * 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 =3D concat_filename (unit->line_table, - attr.u.val); + { + free (func->caller_file); + func->caller_file =3D concat_filename (unit->line_table, + attr.u.val); + } break; =20 case DW_AT_call_line: