From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Todd Zullinger <tmz@pobox.com>,
git@vger.kernel.org
Subject: [PATCH] test-tool: fix leak in delete-gpgsig command
Date: Wed, 29 Oct 2025 15:10:31 -0400 [thread overview]
Message-ID: <20251029191031.GA1257596@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqh5vibpqg.fsf@gitster.g>
On Tue, Oct 28, 2025 at 03:55:51PM -0700, Junio C Hamano wrote:
> * tz/test-prepare-gnupghome (2024-07-03) 2 commits
> - t/lib-gpg: call prepare_gnupghome() in GPG2 prereq
> - t/lib-gpg: add prepare_gnupghome() to create GNUPGHOME dir
>
> Tests did not set up GNUPGHOME correctly, which is fixed but some
> flaky tests are exposed in t1016, which needs to be addressed
> before this topic can move forward.
>
> Will merge to 'next'.
> cf. <ZoV8b2RvYxLOotSJ@teonanacatl.net>
> cf. <xmqqbjlump3m.fsf@gitster.g>
> cf. <87frb310d2.fsf_-_@email.froward.int.ebiederm.org>
> source: <20240703153738.916469-1-tmz@pobox.com>
I noticed jch failing CI. I think we want this on top:
-- >8 --
Subject: [PATCH] test-tool: fix leak in delete-gpgsig command
We read the input into a strbuf, so we must free it. Without this, t1016
complains in SANITIZE=leak mode.
The bug was introduced in 7673ecd2dc (t1016-compatObjectFormat: add
tests to verify the conversion between objects, 2023-10-01). But nobody
seems to have noticed, probably because CI did not run these tests until
the fix in 6cd8369ef3 (t/lib-gpg: call prepare_gnupghome() in GPG2
prereq, 2024-07-03).
Signed-off-by: Jeff King <peff@peff.net>
---
t/helper/test-delete-gpgsig.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/t/helper/test-delete-gpgsig.c b/t/helper/test-delete-gpgsig.c
index e36831af03..658c7a37f7 100644
--- a/t/helper/test-delete-gpgsig.c
+++ b/t/helper/test-delete-gpgsig.c
@@ -23,8 +23,7 @@ int cmd__delete_gpgsig(int argc, const char **argv)
if (!strcmp(pattern, "trailer")) {
size_t payload_size = parse_signed_buffer(buf.buf, buf.len);
fwrite(buf.buf, 1, payload_size, stdout);
- fflush(stdout);
- return 0;
+ goto out;
}
bufptr = buf.buf;
@@ -56,7 +55,9 @@ int cmd__delete_gpgsig(int argc, const char **argv)
fwrite(bufptr, 1, (eol - bufptr) + 1, stdout);
bufptr = eol + 1;
}
- fflush(stdout);
+out:
+ fflush(stdout);
+ strbuf_release(&buf);
return 0;
}
--
2.51.2.833.g5cd7b514cb
next prev parent reply other threads:[~2025-10-29 19:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 22:55 What's cooking in git.git (Oct 2025, #11; Tue, 28) Junio C Hamano
2025-10-29 19:10 ` Jeff King [this message]
2025-10-29 19:35 ` [PATCH] test-tool: fix leak in delete-gpgsig command Junio C Hamano
2025-10-30 15:49 ` What's cooking in git.git (Oct 2025, #11; Tue, 28) Toon Claes
2025-10-31 21:33 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251029191031.GA1257596@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=ebiederm@xmission.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tmz@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://public-inbox.org/mirrors/git.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).