From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81389 invoked by alias); 22 Feb 2019 16:36:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 81329 invoked by uid 89); 22 Feb 2019 16:36:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=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.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Feb 2019 16:36:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id DE708116A15; Fri, 22 Feb 2019 11:36:49 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4F39XnYHi0Gb; Fri, 22 Feb 2019 11:36:49 -0500 (EST) Received: from murgatroyd.Home (75-166-72-210.hlrn.qwest.net [75.166.72.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 8AF5A116A09; Fri, 22 Feb 2019 11:36:49 -0500 (EST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC] Fix BFD leak in solib-darwin.c Date: Fri, 22 Feb 2019 16:36:00 -0000 Message-Id: <20190222163645.9349-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SW-Source: 2019-02/txt/msg00360.txt.bz2 commit 192b62ce0b4bb5c61188f570e127a26d2c32f716 ("Use class to manage BFD reference counts") changed darwin_get_dyld_bfd to use: + dyld_bfd.release (); rather than - do_cleanups (cleanup); However, using release here leaks the BFD. Instead I believe reset should be used instead. I can't readily test this, so please take a look and let me know what you think. gdb/ChangeLog 2019-02-22 Tom Tromey * solib-darwin.c (darwin_get_dyld_bfd): Use reset, not release. --- gdb/ChangeLog | 4 ++++ gdb/solib-darwin.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index d3060604bad..da410ad4660 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -455,7 +455,7 @@ darwin_get_dyld_bfd () if (sub != NULL) dyld_bfd = sub; else - dyld_bfd.release (); + dyld_bfd.reset (nullptr); } return dyld_bfd; } -- 2.20.1