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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 29, 2025 at 15:10 UTC 85333aa1af6ebd609bf564a0ecae0b17c6388546
1 file changed +4 -3
t/helper/test-delete-gpgsig.c
+4 -3
@@ -23,8 +23,7 @@ int cmd__delete_gpgsig(int argc, const char **argv)
23 if (!strcmp(pattern, "trailer")) {
24 size_t payload_size = parse_signed_buffer(buf.buf, buf.len);
25 fwrite(buf.buf, 1, payload_size, stdout);
26 - fflush(stdout);
27 - return 0;
26 + goto out;
27 }
28
29 bufptr = buf.buf;
@@ -56,7 +55,9 @@ int cmd__delete_gpgsig(int argc, const char **argv)
55 fwrite(bufptr, 1, (eol - bufptr) + 1, stdout);
56 bufptr = eol + 1;
57 }
59 - fflush(stdout);
58
59 +out:
60 + fflush(stdout);
61 + strbuf_release(&buf);
62 return 0;
63 }