From patchwork Tue Jun 11 09:20:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13693339 Received: from wfout3-smtp.messagingengine.com (wfout3-smtp.messagingengine.com [64.147.123.146]) (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 57C3D176FA7 for ; Tue, 11 Jun 2024 09:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718097644; cv=none; b=fJrnJkCqmMGBVxkXLqCcRcAsGShpSPbwPh9toWOMj+ZT0Jpvc8I/IS9CGvRVibp02u1TdiQGXlK7ycrGZABewcLp54thOs/hiQ0sfbwbnIp8nzti4Rx0WFU/39a7wzSh+G2tdZms3cJYNVrxjjSVLjxODVk12dFlXB1HuAh/3cY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718097644; c=relaxed/simple; bh=dwYNc4dV5R+PAKUfX3RIC78n7lPKjuJ8CJXOuEPP6ic=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qrchnNmPIjZS3I91dxwaJ4daAg5/0g4T+E5iaZDzuycmnYJrGH421+Suxslrx/dKLyhaEFokSP+PPJfky7rn3cnQK967ZxulTQMJstVt7F+8q1fgJZyWlKnwYenhO8cxhumWjvJcU1dWKwQ7I4c10ShCjMMHlH6eaQGhf5mAYok= 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=hKlbwbmY; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=gU3FLqoP; arc=none smtp.client-ip=64.147.123.146 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="hKlbwbmY"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gU3FLqoP" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.west.internal (Postfix) with ESMTP id 861791C00133; Tue, 11 Jun 2024 05:20:42 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 11 Jun 2024 05:20:42 -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=fm1; t=1718097642; x=1718184042; bh=LmPVacGUQP E3uoWA+rp9OaoARj5bi6mXGw7o89jVOlA=; b=hKlbwbmYRqRiKq8EyH/9XMnQLV c66TNgcZryi38/T1Wc25xfguIdczHvrjtfCWxEoHS9E9z1KsV1GVFLAt3U1jV7TO dFojq5lk4exd1w6h3NJ9IdZhYUuGXjz1iC+rE1sqtPaQjRlRZu3YofdBpKLc9STv H2JWTJ/iBcHEebEzcHb9+m/x1vDWsdP5RbfqFAthS3po0Js5AgOjc2tJQHaVK1iW x2+vgxspite6jr5fhWThZ6y8qiU6ZO4xft3euVf/6/mWuq1Gomw48hQbSd09raDg vnzj+Egxhmyz6/+4QqYQ1vVecqstsmcORrpkJbTbQyWnQwL7ayV0xLm3/smw== 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= fm1; t=1718097642; x=1718184042; bh=LmPVacGUQPE3uoWA+rp9OaoARj5b i6mXGw7o89jVOlA=; b=gU3FLqoPYhgQl5aE/DozKqrnTp6NbmdfGRHM9yxJZJek 1KHZCTP9zI637V3n6W3ISqbW0hX25G7t/kBCB65GdI4MBwWH16yaHHTm3qq4Lu9V va1nFZbi4dguusraaBOzOOzeTi9XymxHxa5gCwIDg9BuO5praFyby5+VaNjZW+5J crrg4aL5czM6Ryo5eLmCfJeNv9R6Li8oFLXDTTF8QsIG4gf2ONGGHp8/YoEDvo5g 4OxMEpCuk6K7en/1zmAEiW3UXADwA0ustMxo3THH8nR2y2A4nNaLKl0DSlSLiSZ6 gEJYANWDTSx4L3SqTwjifRdJrNx0ipN9OAIcSllf0Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeduvddgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 11 Jun 2024 05:20:40 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 79c560e1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 11 Jun 2024 09:20:31 +0000 (UTC) Date: Tue, 11 Jun 2024 11:20:38 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Phillip Wood , Karthik Nayak Subject: [PATCH v2 18/29] config: fix leaking "core.notesref" variable Message-ID: <1700ec8d215d244ad6787880cb25b9acb83fcddd.1718095906.git.ps@pks.im> 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: The variable used to track the "core.notesref" config is not getting freed before we assign to it and thus leaks. Fix this. Signed-off-by: Patrick Steinhardt --- config.c | 1 + t/t3308-notes-merge.sh | 1 + t/t3309-notes-merge-auto-resolve.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/config.c b/config.c index abce05b774..742175c130 100644 --- a/config.c +++ b/config.c @@ -1565,6 +1565,7 @@ static int git_default_core_config(const char *var, const char *value, if (!strcmp(var, "core.notesref")) { if (!value) return config_error_nonbool(var); + free(notes_ref_name); notes_ref_name = xstrdup(value); return 0; } diff --git a/t/t3308-notes-merge.sh b/t/t3308-notes-merge.sh index 202702be1a..e1d05ff6bc 100755 --- a/t/t3308-notes-merge.sh +++ b/t/t3308-notes-merge.sh @@ -5,6 +5,7 @@ test_description='Test merging of notes trees' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' diff --git a/t/t3309-notes-merge-auto-resolve.sh b/t/t3309-notes-merge-auto-resolve.sh index 9bd5dbf341..f55277f499 100755 --- a/t/t3309-notes-merge-auto-resolve.sh +++ b/t/t3309-notes-merge-auto-resolve.sh @@ -5,6 +5,7 @@ test_description='Test notes merging with auto-resolving strategies' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh # Set up a notes merge scenario with all kinds of potential conflicts