From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6SoeLj2xfGl6rx0AWB0awg (envelope-from ) for ; Fri, 30 Jan 2026 08:25:17 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=pCqsTIFR; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B75BB1E0DD; Fri, 30 Jan 2026 08:25:17 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 012BC1E08D for ; Fri, 30 Jan 2026 08:25:17 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 7F8F14BA2E2F for ; Fri, 30 Jan 2026 13:25:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F8F14BA2E2F Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=pCqsTIFR Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id D81B04BA23F0 for ; Fri, 30 Jan 2026 13:17:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D81B04BA23F0 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D81B04BA23F0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779048; cv=none; b=tVaU/FvU4KVVYGowjFmR5+ax3r/hUMIERJxNWy4e4W17OTVCQ5u6ATQg5gHAHPhVqw50dXWO9BLBW9cMqJlXxygoLkhbkgwDfQ4gWga5bFMtUaMF7nIHMhFLxEY2N1A58Ps6nCtxDJopyN88lgTAGbwhQMOEtxb2F8Kk03CE0BQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779048; c=relaxed/simple; bh=Xr0rg/1iRZNeEb0M3ADeky2aEqHsQ7xoaElvw8QwvbE=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=eMwMIlP98rF37dd4efRkmVdzWw5Ic6+3zR6tdADLTKixsRJRgyCsS1nziXvxOR/4iOZWgnCabObJ0bqB+PhsMVHIT0KHsF86SsDjWdLUYUHD0DJnTrTv/tzXxNgxgoA9sVGS5wVE+toYXwzRn2Tn4Orc0sroUIwKvnPBF6Qxpgg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D81B04BA23F0 Received: from eig-obgw-5007b.ext.cloudfilter.net ([10.0.29.167]) by cmsmtp with ESMTPS id lo6VvqdKQVCBNloNLvjS1O; Fri, 30 Jan 2026 13:17:27 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id loNKv3Fi9V6WMloNLvxDyR; Fri, 30 Jan 2026 13:17:27 +0000 X-Authority-Analysis: v=2.4 cv=E//Npbdl c=1 sm=1 tr=0 ts=697caf67 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=ItBw4LHWJt0A:10 a=ljKS1GFvOCrm7wsFqMQA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=N3dlVenv6SMNiXD/oH0vskQSA4koFj6RvuV9oELbPPo=; b=pCqsTIFRhAoiCXWZIZ1TCk4pOI uH779ONRxWGqjFPMSYVAVIadKH6EKwWGkBY7qw4GU8rP8ZbNbgKh1DAFLowQTvwpjWxCRinEAhkB7 bX9ogBUsZots/8yaMLRTUOzqd; Received: from 97-122-114-32.hlrn.qwest.net ([97.122.114.32]:33716 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vloNK-00000001JjQ-2zGh; Fri, 30 Jan 2026 06:17:26 -0700 From: Tom Tromey Date: Fri, 30 Jan 2026 06:17:32 -0700 Subject: [PATCH v3 18/21] Fix leaks with timestamped_file MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260130-pr-28948-logging-5-v3-18-3eec47ef3cba@tromey.com> References: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com> In-Reply-To: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.114.32 X-Source-L: No X-Exim-ID: 1vloNK-00000001JjQ-2zGh X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-114-32.hlrn.qwest.net ([192.168.122.1]) [97.122.114.32]:33716 X-Source-Auth: tom+tromey.com X-Email-Count: 30 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfOKJlmqtrujg+IviPhWDWf2zkQiKURh4n1GcQu8xTkwxvoHqGQLe8utNjuahzmhlQQ6TduHS+XDxwmQKdQNUHPq41LXw2vzfgQxnq7YVp+PdsSUeCo/A 4OI/BTM8erMCGhYQYuP1vowiFkHOFqdRCvkBVKbdb29f5Rpfm2bsU8jIwQCViAwoIpo/Ek6RWyFR7lqMl00CJIP7Mf14yMex3Aw= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This changes timestamped_file to own the stream it wraps. This is done simply because it was appropriate for all the code using this class. --- gdb/tui/tui-io.c | 2 +- gdb/ui-file.h | 6 +++--- gdb/ui.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 41704fc44d1..f673fbf36f6 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -940,7 +940,7 @@ tui_initialize_io (void) /* Let tui_stderr own ERR_OUT. */ tui_stderr = new logging_file (ui_file_up (err_out)); tui_stdlog = (new timestamped_file - (new logging_file (err_out, true))); + (std::make_unique> (err_out, true))); tui_out = new cli_ui_out (tui_stdout, 0); /* Using redirectable_stdout here is a hack. This should probably diff --git a/gdb/ui-file.h b/gdb/ui-file.h index 94897ff0b77..d5771635468 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -442,11 +442,11 @@ class wrapped_file : public ui_file /* A ui_file that optionally puts a timestamp at the start of each line of output. */ -class timestamped_file : public wrapped_file +class timestamped_file : public wrapped_file { public: - explicit timestamped_file (ui_file *stream) - : wrapped_file (stream) + explicit timestamped_file (ui_file_up stream) + : wrapped_file (std::move (stream)) { } diff --git a/gdb/ui.c b/gdb/ui.c index 9d71135bc36..c1fc92e4ee6 100644 --- a/gdb/ui.c +++ b/gdb/ui.c @@ -56,7 +56,7 @@ ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_) m_ui_stderr (new logging_file (std::make_unique (errstream))), m_ui_stdlog (new timestamped_file - (new logging_file + (std::make_unique> (std::make_unique (errstream), true))), m_ui_stdtarg (m_ui_stderr) { -- 2.49.0