From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 7C4AB3856DD2; Thu, 6 Apr 2023 12:00:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C4AB3856DD2 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: objcopy write_debugging_info memory leaks X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: a5f3ca48236a79b0cf78a82dee1cc0241a975eb7 X-Git-Newrev: 11aa9f628e28c077c860480571c152e07e6a4938 Message-Id: <20230406120014.7C4AB3856DD2@sourceware.org> Date: Thu, 6 Apr 2023 12:00:14 +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: Thu, 06 Apr 2023 12:00:14 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D11aa9f628e28= c077c860480571c152e07e6a4938 commit 11aa9f628e28c077c860480571c152e07e6a4938 Author: Alan Modra Date: Thu Apr 6 21:25:22 2023 +0930 Re: objcopy write_debugging_info memory leaks =20 Oops, tried to free too much =20 * wrstabs.c (write_stabs_in_sections_debugging_info): Don't free strings. Diff: --- binutils/wrstabs.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c index b676374558b..234a96f98a3 100644 --- a/binutils/wrstabs.c +++ b/binutils/wrstabs.c @@ -464,7 +464,7 @@ write_stabs_in_sections_debugging_info (bfd *abfd, void= *dhandle, bfd_size_type *pstringsize) { struct stab_write_handle info; - struct string_hash_entry *h, *hnext; + struct string_hash_entry *h; bfd_byte *p; bool ret; =20 @@ -535,11 +535,6 @@ write_stabs_in_sections_debugging_info (bfd *abfd, voi= d *dhandle, free (info.symbols); ret =3D false; out: - for (h =3D info.strings; h !=3D NULL; h =3D hnext) - { - hnext =3D h->next; - free (h); - } while (info.type_stack !=3D NULL) { struct stab_type_stack *s =3D info.type_stack;