From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.147 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796200704; b=kQ9NFpvrtZTPkza5PyU0p3XxmtSeDETDynW7eA9FA+JX9V/HESP5076/pz2D+3q4STJv ufdMED2Bnyh8FfVxsa8F4+HK9cvYcJ5GD0MX2c3rw6RFJHedjxAUyTh4s5UGYJYu5c89N bO2IApAbRsI1ZZVbgoEXuk8s3i+GbhE+cRFjzW3oU4+HCH1xcFQ3q+tLJPzpcXIpEgvNp 9nBDwFMyIGDyRV1+pAZ7o/XGrMG4aBiUFBqDZNR4sIwyEFMDHfMrhj4owBOiJCzxHaXwF 24/8iwTg4FMxGaAceM0HJW+K52ZHZZpBgbX2HsVaP/h0fr9hUed8hP1UEQrXw4BpWvg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796200704; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=gEVLVRMhxv88aX2klAaNTmPJ3LzJbR25V36MKEB9tpk=; b=ysR+3B2W8qCjGHCp7imyOxhEhbdLciKLMjA587qVGpg+8LgqOF69Pqv41IS+ANwW9Ryj 15uuNBSl6rXOU2oS8kH8JAazRIraxKTB/7DMvU/ZFE9bqR1/YfJPeZW+UAdEXMN5UiFd3 1xtPfYJZ+xRRbLI76o9ZFgTaEHLnrMijZT4UPvisi/h4gp8XUIs9EFhk3mPzFwZyx9JYc o1ERcRmF2YwnS1vIT4y/VxgS6uwBbB81+ZGdbQZgLf7WpTd590LK0T10++dPUDSyKgHNb hWfA1+A6pwvMUs11wG20TAynHa0zcy3QZ1BQehyLmt+7zbnzrSXu+Ly1dUp96VRqUqQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=AknlazMn; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=mEYW23rX; arc=none smtp.remote-ip=103.168.172.147 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88D67606A31A for ; Wed, 2 Dec 2026 08:38:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 88D67606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=AknlazMn; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=mEYW23rX Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id E0D1DEC053F for ; Wed, 2 Dec 2026 03:38:22 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Wed, 02 Dec 2026 03:38:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1796200702; x=1796287102; bh=gEVLVRMhxv 88aX2klAaNTmPJ3LzJbR25V36MKEB9tpk=; b=AknlazMnhDAJt2k+3Q35OCkTKw mg7r/xVO5dZjDs90ymWvNKSrRiZ3MVZDvJLNGU4lHcneZFWLti02gX4WqiG3TKZb KMaEF41CmCIS+ixzZegp2cfU1Wexqtc5Z6PHjqluB73GKyuzcoqACMoWLUY0+UWL 6GW2pQiKS3/GJQTsYkep2TqDuv6OvRH39xT9YZb9PMkRckt+Fiauby41hKlm+eRr dBzw4YcOWsl2o7fYAfORjJYAiPTAdorRqk1Zpbs7sEGIn3dVHMXed+9xy4bwbLoJ yPU+kImQJfXd38pbUjke6XAypkgc5KKM7ekMOKgsvqZvtdjqpmM1Kf8z2ZBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1796200702; x=1796287102; bh=gEVLVRMhxv88aX2klAaNTmPJ3LzJbR25V36 MKEB9tpk=; b=mEYW23rXZgIMl+n4lcmB2qXqAdMr/rtUHwovRFMpz+o7dDcLSp7 yzzxbHF4NkJxXYRmpnTiXbeyl80Lyzs9Hv2RcAyFMO/uJ9L39ZIcUxWFxSZc4CIO 0ud5K0AvfE0nUL9zQ1pmnB/ixG8yBTpxWbhVB7QgtsTxft/pwAkrwvTfXWa1rDXH xuaCRizw8N/TC+1+ssXtwmlgsSpbFE5GA/jw7gNXguYjaRgTAmfaJJITK5xA1ppa Uxx01zFNSF3+ydWo8cNqfrNU3oKEH9ii56Vzo7T3TAtwsrEEOXcW+IhmRmoOKIPY i3jUQCfsCzfkcyz1LQHR8D85LiGqqwRSHEw== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pks.im a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796200702; d=pks.im; mf=PHBzQHBrcy5pbT4=; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:R7tGz2Bfz4pAXz2Ig6rSnoMh1TOeA07/qFHQPZCDAFQer1k K4rnbrg/93Xst2mhq5LwvwGjClhBPA2u2hmoTP6i/G0qdgZVL0/bcQgqoYrIYVPG Y3lTgQUlZfnPUB5Ctm/S7FAadP2KW0yo82jfOZ+L0RUAnL3uEVAJLfD9ktdaxImk bF+ObK5W/8UzfiR4U7no/tqUMIZ9Pf0YDwMfdI7OxMN1RMZQpwRJ8ZjIu+iGsrKR Q4V0r5sBkT98KKlH0mu2W69EpHM662BvAwsgzVIByx+ostfS8nRsuFkbPYbT7iYs Zew+QezsndqsQGtnVrIR/yBiQHYpG39JD7rtQfA==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:BkuIApf+P7iaSWWJD5LZYC0aOGN49kA5Oph8ElH8/S0=:SHljKOODV8ycl7v2hb57RPH5T9/rdr2pg/4CqeguZvo=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGRW0KXMDcRVutoXsN9Pf4blXKVYsn8UyvuDWoT5NH0fZasDHNlGdZ5WRD4LbeB84 3NDgfZszMX0IUKsgzNFNUF8isWRzqNX0WGimFe6APhq361ixbAK14pFP6P6rxbZbD+8cGB UbWWzIwvE1hCGh/S2JjwceAOJLi3LEEA71jgZrUOVBT1hM+RZC1eNEGpHmVQD0pJdlHHw1 mZUhIkslZJJL2AhJzwRxkgfQMWX/rSNIidRyNjKELLuIne3hfnhkJSpSOTWqXheU8Tm9TM hsmiy6QtQwKWFuUscx3VZdaCZyY8Bnb9Cr0d662b4OOVGbh9B5SccyW/WZH3BXGczNobn5 UHcymsUkYK5u/MxLxM39NdZPFL7QWp0zP7D7w9f1AVQAmyuUM6GcdgKrnZXQJUf0laUjbW dqT5Cx5HcyJLo8eNV4NamILm2nxADRiG1BFhY1gJGg+8k6U7zSY2UuoxdUtFNRhLEoSHKL UOMep7ZpuftPHuAzyRBSrIdnOzSQKiGyrEAUdTUvZNW9t8Tl7IkEeWMwp/dzeA59eMiSXS TMbxQlJVR1Zu3KvvWWwGQzl2gJsJyzLxx0GDSIAj3Y3JR/82Jru9Q1giR/kTL6BDjMVXVO 1DgIH4JX1vN9j3EGZ0qS2UJg8Z7PuB+ovLRuazDIdAHNvqlXh1Cc+rB/Ds/g X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Dec 2026 03:38:22 -0500 (EST) Received: by mail (OpenSMTPD) with ESMTPSA id 946d6700 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 2 Dec 2026 08:38:21 +0000 (UTC) Date: Wed, 2 Dec 2026 09:38:19 +0100 From: Patrick Steinhardt To: Junio C Hamano Cc: git@vger.kernel.org Subject: Re: [PATCH 4/6] packfile: introduce function to free a packfile Message-ID: References: <20261120-pks-packfile-global-statistics-v1-0-19beb83b145f@pks.im> <20261120-pks-packfile-global-statistics-v1-4-19beb83b145f@pks.im> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Nov 24, 2026 at 01:34:03PM -0800, Junio C Hamano wrote: > Patrick Steinhardt writes: > > > We have a bunch of callsites that want to free a packfile, which > > requires them to first close it followed by a call to free(3p). This > > feels rather leaky as an abstraction. > > > > Introduce `packfile_free()` to handle this properly. This function will > > also be extended in a subsequent patch to maintain a list of all packs. > > OK. > > > +void packfile_free(struct packed_git *p) > > +{ > > + packfile_close(p); > > + free(p); > > +} > > It seems that we have three kinds of free()-like functions in our > system. > > - Ones that make it the responsibility of the caller not to pass NULL > (this one falls into this category). > > - Ones that allows the caller to pass NULL. > > - Ones that not just frees, but clears the pointer the caller has to > prevent future headaches coming from use-after-free (the caller must > pass a pointer to the pointer pointing at the resource being freed). > > It seems all the callsites never passes NULL to this function, so this > is fine as-is, but I wonder if we want to move it to the second category > by guarding against NULL, making it behave similar to free(NULL)? Yeah, that's sensible. Patrick