From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 0E4A53858C50; Wed, 29 Mar 2023 02:50:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E4A53858C50 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] Re: Fix an aout memory leak X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 3901d7da4eef4bd362e5c20189d0dc44c07d168b X-Git-Newrev: 647744420e69bf5fc8f5ab88a9d7dabd6087a890 Message-Id: <20230329025000.0E4A53858C50@sourceware.org> Date: Wed, 29 Mar 2023 02:50:00 +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, 29 Mar 2023 02:50:00 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D647744420e69= bf5fc8f5ab88a9d7dabd6087a890 commit 647744420e69bf5fc8f5ab88a9d7dabd6087a890 Author: Alan Modra Date: Wed Mar 29 09:13:17 2023 +1030 Re: Fix an aout memory leak =20 We have way too much duplicated code in bfd. Apply dd3a3d0af9f6 and 920581c57e08 to pdp11.c. =20 * pdp11.c (bfd_free_cached_info): Free line_buf. Return true if tdata.aout_data is NULL. Diff: --- bfd/pdp11.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 862cf49fda3..9edbba92c82 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -2539,12 +2539,13 @@ NAME (aout, bfd_free_cached_info) (bfd *abfd) { asection *o; =20 - if (bfd_get_format (abfd) !=3D bfd_object) + if (bfd_get_format (abfd) !=3D bfd_object + || abfd->tdata.aout_data =3D=3D NULL) return true; =20 #define BFCI_FREE(x) do { free (x); x =3D NULL; } while (0) + BFCI_FREE (adata (abfd).line_buf); BFCI_FREE (obj_aout_symbols (abfd)); - #ifdef USE_MMAP obj_aout_external_syms (abfd) =3D 0; bfd_free_window (&obj_aout_sym_window (abfd));