From patchwork Fri Sep 1 19:16:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 137409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c792:0:b0:3f2:4152:657d with SMTP id b18csp1094023vqu; Fri, 1 Sep 2023 12:18:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGB4q1E2kRs+BH04a3MkRL9TlnVsum4llHERECIrFpb+rgF85MFmTvxn5aS3Oc0wTfFz/hC X-Received: by 2002:a17:907:b15:b0:9a1:ddb9:6548 with SMTP id h21-20020a1709070b1500b009a1ddb96548mr2390385ejl.59.1693595885698; Fri, 01 Sep 2023 12:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693595885; cv=none; d=google.com; s=arc-20160816; b=FsS2I7y6Lde9TTutPoE8CxXa+XeglVgANpRpz5WHWtoi6r8CLelYTO2RZvQDNtsJKu ikFX8MOC7HmE7QaNnK1wrPFoXy7cHqKnmOCAHlJVu5Nyfpj6RT/V9nhABA3GksjI2KOH 2fFQSJ8N8dYmLTmRpzumZQMyDvv6wtR6iLRqx7BY7Y/5va7AfX8nBMDkGIk5C++C/cId y+s8oOAY0nsHxttqKNWKKHe+9PolYZn+jnlaUswK6S75RPZfxBytM2zL01l/OLJ4iF9m b5MqU0X1QJ4o8uUmCFSIHnZ9ip0qhFS0f9NpnS6duQGaqzU6JOGNhBjBh+3s7nvz+YW4 FP/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=uxDD/yoiCKGIVQSdxb6RLIHFBrqE8XWwmYDKD4GNKrc=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=aWSEo9fa+9c05gKY2EhyoKS1w5ffWBQmPJQfs5NXC45V9hnsHMfIqVogBIkUSeevah Vek1KbjDZ9z5XZLOaxBjoBnW830meGznl6wAW4ORRQrA5bsc3nE27JYfWPtG1kHn6F36 9StTpPoTdz3KQqKEOWc5GC2y62CsDJXi++0na39bFtZofOfxhXr1Uk2/V0Oh+srYbA2x 1QNR+WVJeJkIgDgYjKpHJx9TdD92Ylw1UJ0mCcOjynwkA4D4WTzXTTMhoCsYcmbMuoh7 EAeCqXMhEN31F5coD+sC9Ogy9B9QY3tOmG/NiRMWqaw5J4yjyxRQfQLVCFbLSVzxUlA2 VhNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=OAlYB5GL; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id rp26-20020a170906d97a00b00993690d17a2si2780965ejb.5.2023.09.01.12.18.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 12:18:05 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=OAlYB5GL; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 69B9C3856DEA for ; Fri, 1 Sep 2023 19:17:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69B9C3856DEA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693595871; bh=uxDD/yoiCKGIVQSdxb6RLIHFBrqE8XWwmYDKD4GNKrc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=OAlYB5GL0ab1qN9N8YiONMilSTMs48zT8gQIQiQoxHHpRPzj1SOZfh3oQGdjoPi1Q 7TkldC5RxpBGBtP+4uuzTBDu54g+l2EHVarZ0hCPGEaVfrPkrxtORxpNju0WZVXUvR 6TE4Cso8dFYSHtpUzH6tP6JtIas8uRujdx9QLjik= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.smtpout.orange.fr (smtp-30.smtpout.orange.fr [80.12.242.30]) by sourceware.org (Postfix) with ESMTPS id F18E73858D20 for ; Fri, 1 Sep 2023 19:17:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F18E73858D20 Received: from cyrano.home ([86.215.161.51]) by smtp.orange.fr with ESMTPA id c9dXq2QpFbNd0c9dcqYKwN; Fri, 01 Sep 2023 21:17:01 +0200 X-ME-Helo: cyrano.home X-ME-Auth: bW9yaW4tbWlrYWVsQG9yYW5nZS5mcg== X-ME-Date: Fri, 01 Sep 2023 21:17:01 +0200 X-ME-IP: 86.215.161.51 To: gcc-patches@gcc.gnu.org Subject: [PATCH] diagnostics: Delete config pointer before overwriting it. Date: Fri, 1 Sep 2023 21:16:54 +0200 Message-Id: <20230901191654.320202-1-mikael@gcc.gnu.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Mikael Morin via Gcc-patches From: Mikael Morin Reply-To: Mikael Morin Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775863999620152504 X-GMAIL-MSGID: 1775863999620152504 Hello, this is a fix for a small memory leak in the fortran frontend. Tested on x86_64-pc-linux-gnu, nothing stands out besides the apparently well-known guality instability. OK for master ? -- >8 -- 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. --- gcc/tree-diagnostic.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/tree-diagnostic.cc b/gcc/tree-diagnostic.cc index 731e3559cd8..d2f6637b6d9 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 (); }