From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33310 invoked by alias); 4 Jan 2020 08:59:25 -0000 Mailing-List: contact gdb-testers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-testers-owner@sourceware.org Received: (qmail 33302 invoked by uid 89); 4 Jan 2020 08:59:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: kwanyin.sergiodj.net Received: from kwanyin.sergiodj.net (HELO kwanyin.sergiodj.net) (158.69.185.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 Jan 2020 08:59:24 +0000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] coff: free malloc'd memory on successful target match too From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: <991fb595e34598291a52b533fdc8005e1ead0799@gdb-build> Date: Sat, 04 Jan 2020 08:59:00 -0000 X-SW-Source: 2020-q1/txt/msg00279.txt *** TEST RESULTS FOR COMMIT 991fb595e34598291a52b533fdc8005e1ead0799 *** commit 991fb595e34598291a52b533fdc8005e1ead0799 Author: Alan Modra AuthorDate: Wed Jan 1 10:28:42 2020 +1030 Commit: Alan Modra CommitDate: Sat Jan 4 18:53:07 2020 +1030 coff: free malloc'd memory on successful target match too object_p functions cannot allocate memory by malloc and not free it before returning. Even a successful target match may not be the best match. If a match isn't used then those malloc'd blocks won't be freed. * coffgen.c (coff_real_object_p): Free malloc'd memory on target match too. diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0ad28a798d..6d19839fec 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-01-04 Alan Modra + + * coffgen.c (coff_real_object_p): Free malloc'd memory on target + match too. + 2020-01-03 Nick Clifton PR 25307 diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 68b81ec588..2bfcf1a6b1 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -302,6 +302,9 @@ coff_real_object_p (bfd *abfd, } } + obj_coff_keep_syms (abfd) = FALSE; + obj_coff_keep_strings (abfd) = FALSE; + _bfd_coff_free_symbols (abfd); return abfd->xvec; fail: