From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1647) id 798433858D39; Sat, 2 Sep 2023 11:00:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 798433858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693652443; bh=30dCgpOCE9dmU/OMUa1bl16HMtsObCZUzsajH4jbiqE=; h=From:To:Subject:Date:From; b=lOWR2hlFgJrwLgTYpwIni9dHsi4IN9Iq5qG2qj6Ng70S5ak0ep3HHSwsnsIBMEjne R4Si4P1Dc3QlswO+uqml9nMwvFKveONutyXX3Ta0sU9606mZGdWpFR93VAT3Zwg+WK 3YiLSI8ACJjL5b/2oQIXwkQyUMh9YRJw6+ADHV04= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Mikael Morin To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-3636] diagnostics: Delete config pointer before overwriting it X-Act-Checkin: gcc X-Git-Author: Mikael Morin X-Git-Refname: refs/heads/master X-Git-Oldrev: 4e2d53c943400e8b5d49a7d5aab4a1ad046aefba X-Git-Newrev: 474473f0425b404cd3ce15e73844de4608ac4ba7 Message-Id: <20230902110043.798433858D39@sourceware.org> Date: Sat, 2 Sep 2023 11:00:43 +0000 (GMT) List-Id: https://gcc.gnu.org/g:474473f0425b404cd3ce15e73844de4608ac4ba7 commit r14-3636-g474473f0425b404cd3ce15e73844de4608ac4ba7 Author: Mikael Morin Date: Sat Sep 2 12:55:25 2023 +0200 diagnostics: Delete config pointer before overwriting it Delete m_client_data_hooks before it is reassigned in tree_diagnostics_defaults. This fixes a small memory leak in the fortran frontend, which restores the diagnostics configurations to their default values with a call to tree_diagnostics_defaults at the end of the main parse hook. gcc/ChangeLog: * tree-diagnostic.cc (tree_diagnostics_defaults): Delete allocated pointer before overwriting it. Diff: --- gcc/tree-diagnostic.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/tree-diagnostic.cc b/gcc/tree-diagnostic.cc index 731e3559cd81..d2f6637b6d95 100644 --- a/gcc/tree-diagnostic.cc +++ b/gcc/tree-diagnostic.cc @@ -377,5 +377,6 @@ tree_diagnostics_defaults (diagnostic_context *context) context->print_path = default_tree_diagnostic_path_printer; context->make_json_for_path = default_tree_make_json_for_path; context->set_locations_cb = set_inlining_locations; + delete context->m_client_data_hooks; context->m_client_data_hooks = make_compiler_data_hooks (); }