From patchwork Mon Jun 3 09:46:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13683529 Received: from wfout4-smtp.messagingengine.com (wfout4-smtp.messagingengine.com [64.147.123.147]) (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 6FBE0127B67 for ; Mon, 3 Jun 2024 09:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717408003; cv=none; b=Qoo24PWYxC4Hs2AZqzX/JvUR1ZR08OYDxF+yGGxfBH/m4e+IrVf9du6ylD1EfXKvR8MJf/WbXFpUuAMZpYDlV9rwA4QIsC+FnHX68vrgyx+k/5r8K5FP0sL9bRr6G4uBLEiaPJD79vegyeGjGBa+93D6f3B4nzNdqGhWoF7gNm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717408003; c=relaxed/simple; bh=7OcRvs4ODLoQT/Fiqp6N2ufPGHJh1u0srE4wYrHqAV4=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=e1oWCOFFJG/hfUrsc/A+xP50/kdK5cxTwa4aDwNEW6TjysmMvkpbSZ4afFS4evQmtNdMN8Xzz6aCA7tbco5KcgHrST/qZ6vpA0vn9HNjamA70/4ITTayZiInfVH+85i+OeynO059p8fMs/dHHhlUvMWX5S0ea8Tlj5xAxfQ1MBg= 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=JCFV+omn; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=j4jC21nM; arc=none smtp.client-ip=64.147.123.147 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="JCFV+omn"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="j4jC21nM" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfout.west.internal (Postfix) with ESMTP id 9F93B1C0010F for ; Mon, 3 Jun 2024 05:46:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 03 Jun 2024 05:46:41 -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=fm1; t=1717408001; x=1717494401; bh=NkF6twfE3U HrVXDGjLf5IoyU1Pnywa7qXkGqAikbi3A=; b=JCFV+omn3SJlfVy26aJa4/rGUb cJAWxLtID7A3rglmexJVJctjgCpkcwHv90Ay4cDye+6KZnbSOy0iwSbhL/eLpRY7 0Suh+qxuWvPTVsPiDw060VoSt2Hn0nCYjyOsHDK/OfPg9QvH7djRphEAT1pRHzyV QuCqWkAdOEdVvUKyIm3Y5kvgs9o70isCCNM0j5NcitRw4WLu9MUdJ/ThZADheFmo gOEawKPCFqTCQT075OknsxfOKe8ZIjGfjbkMqZ+TvIBH5s/H8PAlM8nWIeAtao/Y Y6ui1OMF2o1i5u3wIqJfVtU3GWUn4HwVKHb7PsqnSZEpy4Lgb1JifVWq2/4g== 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= fm1; t=1717408001; x=1717494401; bh=NkF6twfE3UHrVXDGjLf5IoyU1Pny wa7qXkGqAikbi3A=; b=j4jC21nM0FG3G9sR2JHguLCZEp6gT5xOAP3BNpYCS4oq Vw6B84vLX+KZ67A9gV8prNUvGik9lbNxQFTKp18AeLd2E/jpunGsvInO20/6Mxhe adCAM/Im60BkZkfHEqWXpxM1qY5/71BdMRA2yAAoK3o0hd6BDQkrPXZw0LDhZHkj YWq9rvRP54iHuM64Q+oT08iWwRpOBH9yzP5eWyRihwXtYBvedZG959EZ6LRvisjw RmdH1YJjkWSm7ER8a0VK8usDpd/qqeZEZi+beImABBgmYLxTIvz9Ya3wDpRh8EXU TJyyeYu+5Z0PNNg+zSTnPNcJa7u7GdtPGtI7Wl88Cw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelvddgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesghdtre ertddtvdenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehp khhsrdhimheqnecuggftrfgrthhtvghrnhepheeghfdtfeeuffehkefgffduleffjedthf dvjeektdfhhedvlefgtefgvdettdfhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 3 Jun 2024 05:46:40 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id a5903f23 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 3 Jun 2024 09:46:15 +0000 (UTC) Date: Mon, 3 Jun 2024 11:46:37 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Subject: [PATCH 03/29] notes-utils: free note trees when releasing copied notes Message-ID: <17a8f532752e005601b1cff5690a4dae16096b8b.1717402439.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: While we clear most of the members of `struct notet_rewrite_cfg` in `finish_copy_notes_for_rewrite()`, we do not clear the notes tree. Fix this to plug this memory leak. Signed-off-by: Patrick Steinhardt --- notes-utils.c | 1 + t/t3400-rebase.sh | 1 + t/t7501-commit-basic-functionality.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/notes-utils.c b/notes-utils.c index e33aa86c4b..671d1969b1 100644 --- a/notes-utils.c +++ b/notes-utils.c @@ -187,6 +187,7 @@ void finish_copy_notes_for_rewrite(struct repository *r, for (i = 0; c->trees[i]; i++) { commit_notes(r, c->trees[i], msg); free_notes(c->trees[i]); + free(c->trees[i]); } free(c->trees); free(c); diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index e1c8c5f701..ae34bfad60 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -11,6 +11,7 @@ among other things. GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh GIT_AUTHOR_NAME=author@name diff --git a/t/t7501-commit-basic-functionality.sh b/t/t7501-commit-basic-functionality.sh index cc12f99f11..52f5e28154 100755 --- a/t/t7501-commit-basic-functionality.sh +++ b/t/t7501-commit-basic-functionality.sh @@ -9,6 +9,7 @@ test_description='git commit' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY/lib-diff.sh"