From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 77A1D3857B98; Wed, 7 Jun 2023 02:02:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77A1D3857B98 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] bfd/elf.c strtab memory leak X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: f5c0d77088ee2878813861b5b72fa64001f1831a X-Git-Newrev: c7e6669a5b29240b1e5f6fd2acc987fd75b71044 Message-Id: <20230607020219.77A1D3857B98@sourceware.org> Date: Wed, 7 Jun 2023 02:02:19 +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: Wed, 07 Jun 2023 02:02:19 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc7e6669a5b29= 240b1e5f6fd2acc987fd75b71044 commit c7e6669a5b29240b1e5f6fd2acc987fd75b71044 Author: Alan Modra Date: Wed Jun 7 09:41:57 2023 +0930 bfd/elf.c strtab memory leak =20 * elf.c (_bfd_elf_compute_section_file_positions): Free strtab on set_group_contents failure return path. Diff: --- bfd/elf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bfd/elf.c b/bfd/elf.c index 81eb3ef71fa..af2fb04dcbe 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -4254,7 +4254,11 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, { bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed); if (failed) - return false; + { + if (need_symtab) + _bfd_elf_strtab_free (strtab); + return false; + } } =20 shstrtab_hdr =3D &elf_tdata (abfd)->shstrtab_hdr;