From patchwork Mon Sep 30 09:13:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13815667 Received: from fout-a2-smtp.messagingengine.com (fout-a2-smtp.messagingengine.com [103.168.172.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D24717A5A4 for ; Mon, 30 Sep 2024 09:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727687606; cv=none; b=lvPHU+1aVLXTDlDZexCTEOTjoUI/xnLzVYJvDNGmKHwpWvP4J8hGjRTxDH77HUTisMiwHtHpIHO6f/73LX/ZCgSfQj6UCimq5CjMXB6vLanb3poddllYEpOfKzWVJGDrU8yPcuNsv9mtU0rJfbO3A/9Ksl7DTAbzJGKQZuJwdhc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727687606; c=relaxed/simple; bh=W9psKAvuz74AsfRxjWpJZbr/JtwTbFs+uy3iQ6niIXk=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C9M+45s4ubT6gpcU05nwG94WfQjbkScr9k6kyUqZ0IuAyWnEKNNd5o8jDfTo91QKPmHkoz1mv7Wh/rt4vmYIMLmCH8x1J9SRz46xXSw45ZrZKYFlJ4WmYRdgQrctSIWT/BRUhjvA71jBNslFbZLbZGSemEk6MUX7RFqYR+Wd9f4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=N+S5IxXb; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=FbUjC4ho; arc=none smtp.client-ip=103.168.172.145 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) header.d=pks.im header.i=@pks.im header.b="N+S5IxXb"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="FbUjC4ho" Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 8144C13800E7 for ; Mon, 30 Sep 2024 05:13:23 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Mon, 30 Sep 2024 05:13:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=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=fm2; t=1727687603; x=1727774003; bh=Mr5lakhXG6 HKUlD9w81t+IlvQWmoV5y8xTZB6taOt0M=; b=N+S5IxXbTe/oTgSDhnEYGeSwZj 1vmDfO0kv+wmpRL1lzdskzPuvd54FRIpUkm6mViUw5tT8ywTq/gTN03b3EGrebDV U8N6mXmrMW4nfX5vrjQG/dERwgxZuXS5CSWFnXOoQEZHnw8Xek+rIXU1C+eJpo42 yYAorSoJYsY0YgzYw6m8F4W78VEdJmR8LYviPvH2qr8rOX5mQfYM+DZw20Dh/QWz MQ1VUJ0z/6glXy7O+V6l8eOdgCgBrldrjWGCfOKfzE56UxfCw/odHGMT5Y3bwH7t E+mge2gkFq4H8OsWQ4sjNLxgIxn4yf05mRaMB8CRkgJkbkftcMpJvLeHhFPQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1727687603; x=1727774003; bh=Mr5lakhXG6HKUlD9w81t+IlvQWmo V5y8xTZB6taOt0M=; b=FbUjC4hoihvSCrNv2Pe1BsciXEUDZj6YKRCwHPcGS5zQ T2BfAhbhz9mWHzNl0bu591e9no7iCIXwdd15McvCT1hGWVNkREFXHuzxqF2rLUnz 74tonD4/0+MAlZL5Tq0vxPRksKBvV/qivaWhKg1p/CWdXKy48h5agpo3ZvxOEiiH G7utC2WFtMINHrAPFF5fTioVav08VZEbbH6EoWAXcoq4hcXcMxIAtuONu/7mOAtO QZZtcrjxgdMjP/oXUhg/CQGp1vAGtuFrORCy/LQjydcMki8WSfm5WWb3MyI2wmyX cCq4pd4ExYilVv/hAnHgJYVorT4jMx1xmO1X7aBB/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduhedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuf fkfhggtggujgesthdtredttddtvdenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhh rghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepheekfeefgeegvd egvdeffeehtedttdffjeeuffelgffgheefleffleejvdefheeinecuvehluhhsthgvrhfu ihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspg hrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithesvhhg vghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 30 Sep 2024 05:13:22 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 40d378ac (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 30 Sep 2024 09:12:36 +0000 (UTC) Date: Mon, 30 Sep 2024 11:13:15 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Subject: [PATCH 03/23] scalar: fix leaking repositories Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: In the scalar code we iterate through multiple repositories, initializing each of them. We never clear them though, causing memory leaks. Plug them. Signed-off-by: Patrick Steinhardt --- scalar.c | 1 + t/t9210-scalar.sh | 1 + t/t9211-scalar-clone.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/scalar.c b/scalar.c index 09560aeab5..ede616ad4f 100644 --- a/scalar.c +++ b/scalar.c @@ -732,6 +732,7 @@ static int cmd_reconfigure(int argc, const char **argv) succeeded = 1; the_repository = old_repo; + repo_clear(&r); loop_end: if (!succeeded) { diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh index e8613990e1..a131a6c029 100755 --- a/t/t9210-scalar.sh +++ b/t/t9210-scalar.sh @@ -2,6 +2,7 @@ test_description='test the `scalar` command' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab cron.txt,launchctl:true,schtasks:true" diff --git a/t/t9211-scalar-clone.sh b/t/t9211-scalar-clone.sh index 7869f45ee6..c16ea67c1d 100755 --- a/t/t9211-scalar-clone.sh +++ b/t/t9211-scalar-clone.sh @@ -2,6 +2,7 @@ test_description='test the `scalar clone` subcommand' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "${TEST_DIRECTORY}/lib-terminal.sh"