From patchwork Wed Oct 10 12:57:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 29694 Received: (qmail 118422 invoked by alias); 10 Oct 2018 12:58:04 -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 118401 invoked by uid 89); 10 Oct 2018 12:58:04 -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, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Oct 2018 12:58:03 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1051830820D5 for ; Wed, 10 Oct 2018 12:58:02 +0000 (UTC) Received: from blade.nx (ovpn-117-250.ams2.redhat.com [10.36.117.250]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC7DD1001947 for ; Wed, 10 Oct 2018 12:58:01 +0000 (UTC) Received: from blade.com (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id DD6C480B0905 for ; Wed, 10 Oct 2018 13:58:00 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 1/2] Fix resource leak found by Coverity Date: Wed, 10 Oct 2018 13:57:56 +0100 Message-Id: <1539176277-4500-2-git-send-email-gbenson@redhat.com> In-Reply-To: <1539176277-4500-1-git-send-email-gbenson@redhat.com> References: <1539176277-4500-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes This commit fixes a resource leak found by Coverity, where cli_interp's constructor creates a new cli_ui_out, but there was no corresponding destructor to free it. gdb/ChangeLog: * cli/cli-interp.c (cli_interp::~cli_interp): New function. --- gdb/ChangeLog | 4 ++++ gdb/cli/cli-interp.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index 2aa41d6..75d8093 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -44,6 +44,7 @@ class cli_interp final : public cli_interp_base { public: explicit cli_interp (const char *name); + ~cli_interp (); void init (bool top_level) override; void resume () override; @@ -62,6 +63,11 @@ cli_interp::cli_interp (const char *name) this->cli_uiout = cli_out_new (gdb_stdout); } +cli_interp::~cli_interp () +{ + delete cli_uiout; +} + /* Suppress notification struct. */ struct cli_suppress_notification cli_suppress_notification = {