From patchwork Thu Aug 8 07:35:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13757062 Received: from fhigh8-smtp.messagingengine.com (fhigh8-smtp.messagingengine.com [103.168.172.159]) (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 CD8EA188CAE for ; Thu, 8 Aug 2024 07:35:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723102561; cv=none; b=Ap4iX8jfsTu7XZJMraIEaS61M3T39wzWzvgUJ5/P6jk+i++OC5zNcgolJv5wzwAcDaJtprm/0sadbHv54yFp33rYSBfi8lsiJZ2TjcGYCRkh0/3vu+Bu0ppg1wLLuCo07YzWd/+fmBoOwvqS0f9MmbXyxdTmFq840BpArgr+ZiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723102561; c=relaxed/simple; bh=LGMkl10FM+0W9xFnf9XcL5J6xATPimqHtR/5EGh/NwQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Gjcxru+oqWrOaCWCuyWNbKWzgS+Id0lTLuzuMw8Tt4LRoUzMDVlFqYssr3ulqmX/8iCIohg1cYhY7o/iiXxBeQoNPzgdLCuoY/7mC/toeaR0VHfN3a2HhvAkrAo+NTm3qeOAPyqURlr/of+BVThWvVN0xIwLQfdhuuwiqVamNsc= 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=KtJkIKV+; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=llYQNG4L; arc=none smtp.client-ip=103.168.172.159 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="KtJkIKV+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="llYQNG4L" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id EDA191151B80; Thu, 8 Aug 2024 03:35:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 08 Aug 2024 03:35:58 -0400 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=1723102558; x=1723188958; bh=hv1CIfxmPF 7BptPBkx+G6Dyrawma91txl0UC4/NUnzw=; b=KtJkIKV+uadlqyyGk0UYUsUJR1 QJj5l44C6Sh2yVOu9E6Bajd2u/HJ9rWWiqhmUvyqDGTSh6rsnRAlzAFZlCNOa8v0 Ap6YAEZkR7Epm8rvfuzuRAi+a7coUX4Zgu0GuC+OJPXZnSaF3B2vtnl23eCsqidv kM+OTvBpC9IwkUSjs5Tjfff+dSYs+ITNlT9VDAeSTuAp7ZGzom0tVxIztU/iad45 0KnHLwfdEXpubauX9I7/Vz2TDSG4n75Ed2Jx4r5VrEplaQn7nctZwr+qBREn8gpF nw2Y7cZQ+d8xLTggJsYwczG2CmL+fIohkAeszdaOuVZGct9ufU4hkoQ9PIWw== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1723102558; x=1723188958; bh=hv1CIfxmPF7BptPBkx+G6Dyrawma 91txl0UC4/NUnzw=; b=llYQNG4LSzZlLz6ISKILWH+g2aFeimHnjrDgEUVKs/B7 XnGtH443v3v/HuaSE+n7rzKgrtuMLLrf5NozF4swG7cX8oAmHk0z3TFtsrt+Tkk/ boVlg6RH1MtLTNyOIlfXQFNbCLDu5ZM6zGBevmLy5ZtHtVy4LdDoXvU0tdGSnets pH9VdvkBclQsPoAUSrX8xnv0tuC+EbCp9XAsVjD1HuePEMCWBVTDzkHlyGjq6aCR l+7q+1qCTsKfs41n5I0+1qCL8P7I+KBCn59cZGZofjIvk05D4vkeZrIBsKJ/QGpz BUVGsQA+dFzbhrPjzv7H+nzQAcQPE5yAWtWHPekqMg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrledugdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeg hefgledttdehjeelffetnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepgedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtph htthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhunhhs hhhinhgvsehsuhhnshhhihhnvggtohdrtghomhdprhgtphhtthhopehjohhlrghnugesgh hmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 8 Aug 2024 03:35:57 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e562387d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 8 Aug 2024 07:35:51 +0000 (UTC) Date: Thu, 8 Aug 2024 09:35:56 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eric Sunshine , Jeppe =?utf-8?b?w5hsYW5k?= , Junio C Hamano Subject: [PATCH v2 7/8] submodule: fix leaking seen submodule names 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: We keep track of submodules we have already seen via a string map such that we don't process the same submodule twice. We never free that map though, causing a memory leak. Fix this leak by clearing the map. Signed-off-by: Patrick Steinhardt --- submodule.c | 1 + t/t5572-pull-submodule.sh | 1 + t/t7418-submodule-sparse-gitmodules.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/submodule.c b/submodule.c index f027a6455e..13b8f8c19c 100644 --- a/submodule.c +++ b/submodule.c @@ -1880,6 +1880,7 @@ int fetch_submodules(struct repository *r, strvec_clear(&spf.args); out: free_submodules_data(&spf.changed_submodule_names); + string_list_clear(&spf.seen_submodule_names, 0); return spf.result; } diff --git a/t/t5572-pull-submodule.sh b/t/t5572-pull-submodule.sh index 51744521f7..916e58c166 100755 --- a/t/t5572-pull-submodule.sh +++ b/t/t5572-pull-submodule.sh @@ -5,6 +5,7 @@ test_description='pull can handle submodules' GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1 export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-submodule-update.sh diff --git a/t/t7418-submodule-sparse-gitmodules.sh b/t/t7418-submodule-sparse-gitmodules.sh index dde11ecce8..e1d9bf2ee3 100755 --- a/t/t7418-submodule-sparse-gitmodules.sh +++ b/t/t7418-submodule-sparse-gitmodules.sh @@ -15,6 +15,7 @@ also by committing .gitmodules and then just removing it from the filesystem. GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1 export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'setup' '