From patchwork Sun May 27 21:00:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27524 Received: (qmail 25008 invoked by alias); 27 May 2018 21:01:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 24636 invoked by uid 89); 27 May 2018 21:01:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.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_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (192.185.193.119) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 27 May 2018 21:01:24 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway36.websitewelcome.com (Postfix) with ESMTP id A0CC04066A50F for ; Sun, 27 May 2018 16:01:00 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id N2mifp2TtaSeyN2mifaIVp; Sun, 27 May 2018 16:01:00 -0500 X-Authority-Reason: nr=8 Received: from 174-29-44-154.hlrn.qwest.net ([174.29.44.154]:53350 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fN2mi-000gJZ-DM; Sun, 27 May 2018 16:01:00 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 3/3] Use unique_xmalloc_ptr in solib-aix.c Date: Sun, 27 May 2018 15:00:57 -0600 Message-Id: <20180527210057.12554-4-tom@tromey.com> In-Reply-To: <20180527210057.12554-1-tom@tromey.com> References: <20180527210057.12554-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fN2mi-000gJZ-DM X-Source-Sender: 174-29-44-154.hlrn.qwest.net (bapiya.Home) [174.29.44.154]:53350 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This removes a cleanup from solib-aix.c via unique_xmalloc_ptr. ChangeLog 2018-05-27 Tom Tromey * solib-aix.c (solib_aix_get_section_offsets): Return unique_xmalloc_ptr. (solib_aix_solib_create_inferior_hook): Update. --- gdb/ChangeLog | 6 ++++++ gdb/solib-aix.c | 12 +++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index f3dfdb577c9..a488dbc057a 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -439,14 +439,14 @@ solib_aix_clear_solib (void) The resulting array is computed on the heap and must be deallocated after use. */ -static struct section_offsets * +static gdb::unique_xmalloc_ptr solib_aix_get_section_offsets (struct objfile *objfile, lm_info_aix *info) { - struct section_offsets *offsets; bfd *abfd = objfile->obfd; - offsets = XCNEWVEC (struct section_offsets, objfile->num_sections); + gdb::unique_xmalloc_ptr offsets + (XCNEWVEC (struct section_offsets, objfile->num_sections)); /* .text */ @@ -515,12 +515,10 @@ solib_aix_solib_create_inferior_hook (int from_tty) if (symfile_objfile != NULL) { - struct section_offsets *offsets + gdb::unique_xmalloc_ptr offsets = solib_aix_get_section_offsets (symfile_objfile, exec_info); - struct cleanup *cleanup = make_cleanup (xfree, offsets); - objfile_relocate (symfile_objfile, offsets); - do_cleanups (cleanup); + objfile_relocate (symfile_objfile, offsets.get ()); } }