From patchwork Thu Aug 1 10:38:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13750130 Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.148]) (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 6C8DC170A33 for ; Thu, 1 Aug 2024 10:38:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722508716; cv=none; b=TjWHicY9lL+pAlWeMgzohRzhkUmvhwdCl8QXWhQsBL9hl2zhSPOcY6yOUFZIJnF0En3JQ4H5Z3vdoWvbn0CnJqzyqiZZu45VcKRvn1VEKfu3z5imIzH97ZW6k3mlc0K143nKKAFNriRWpe1QUYHxdyiA29+oDMsJGkDRXG9HD4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722508716; c=relaxed/simple; bh=uMXS4ZDGtRn2npjYLU1Hf6wryCrN6ryHqh68Znoss6c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=O5uCbLAlIyZC6iI87ejQ58vsI4nmAFHFpgf958S4EahOl3JNPmAnhIrVa2xZz+yKFdkWGIJnJRxQuRR6sejX5OlLvF4il4gnsUgfYiK2dGH5iL3zt6ugxHs+CJja5H71s7M5SnBILZsA7u6eOXVBj+r7peJHvbecYFne05A2K5Y= 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=n74L809v; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=AUV/ENi6; arc=none smtp.client-ip=103.168.172.148 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="n74L809v"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="AUV/ENi6" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 8CB181388012; Thu, 1 Aug 2024 06:38:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 01 Aug 2024 06:38:33 -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=1722508713; x=1722595113; bh=WqQz/r8eUV G5acOxYvOKLNinczBnV7Jqpwj8zkTQ3Ec=; b=n74L809v2MXHcvSJibSWMxrd2s MJcMH58XMpCDCT0Ugg7it49q/fTWxiSTM/xNLrbBkNS7aoq/zyY2TCQsZlyhJzGB gIm62e+S9axM3i5gHT72rPJ8irO82o/FNlg8EDjzON5vAaj/8R6PdhHP9QExw4AO xnQASGoD4rLNrXzDxZMCl7zqJUNFh11ftyJz/MHbG6nkesqHlZPC8aah0pYC1meA TVVFjsco2VtksR1iOE2JvPIzSw/z3mz+qvUBBnIQGsUD80CrXe4BnH1bbgbOQ0f8 TgqBVY86yckzdk9Rcx4TsInbVIo6r6MqGzadfHN2hnZ3iLZlpz/Tt0pEhfhQ== 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=1722508713; x=1722595113; bh=WqQz/r8eUVG5acOxYvOKLNinczBn V7Jqpwj8zkTQ3Ec=; b=AUV/ENi6R1Ojakr0FcGLGm3H1cZp0RnEttd13NdzAQrs +/zWTxa7L+xthB5I79cB+1EBapnnXDfElcRfJNPf8Xdak271M0TJGhKazcNb1jlw 2aHbaK0udUHF4q9ma67TC/gEmBmWwvHKKqOSL7RUy2QKULBESvIkV9+PcrIxvg8b RQBKawVlBzs2DFcvBN9mMaRtMLMKMe0zMVepa9ZgVeEO19QqFsBIbX32grkLRhJn oCOiltzj96gQ3SS3/+CxV10pU4IL8+kAguUbW0gXLkXckJslxty5CyfprM5qXFOp OG0tG+1rOxtcV0MYEqdaWYM1CxXUgMJ22LZbQN4Tgg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrjeekgdeftdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhmpdhnsggprhgtphhtthhopedt X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Aug 2024 06:38:32 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 592ffea1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 1 Aug 2024 10:37:00 +0000 (UTC) Date: Thu, 1 Aug 2024 12:38:30 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Karthik Nayak , Taylor Blau , Junio C Hamano , =?utf-8?b?UnViw6lu?= Justo Subject: [PATCH v2 05/24] builtin/describe: fix trivial memory leak when describing blob Message-ID: <6deacb8667bfe94cdb5995302490b977b7fd2e8a.1722499961.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: We never free the `struct strvec args` variable in `describe_blob()`, which thus causes a memory leak. Fix this. Signed-off-by: Patrick Steinhardt --- builtin/describe.c | 1 + t/t9903-bash-prompt.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/builtin/describe.c b/builtin/describe.c index 2957ff7031..954929c514 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -529,6 +529,7 @@ static void describe_blob(struct object_id oid, struct strbuf *dst) traverse_commit_list(&revs, process_commit, process_object, &pcd); reset_revision_walk(); release_revisions(&revs); + strvec_clear(&args); } static void describe(const char *arg, int last_one) diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index d667dda654..95e9955bca 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -8,6 +8,7 @@ test_description='test git-specific bash prompt functions' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_PASSES_SANITIZE_LEAK=true . ./lib-bash.sh . "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"