aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-26 10:32:41 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-26 10:32:41 -0800
commit24ddb3f1fca17cbfd59eb693b352a09d45373d96 (patch)
tree4594459b8301bb1373e624b4afaf9f76c1f928ed
parent370470e240b5c855af32f7123de3f1e612b0d2b7 (diff)
parent14b561e7685ee91d6a3d39684f9089c902641083 (diff)
downloadgit-24ddb3f1fca17cbfd59eb693b352a09d45373d96.tar.gz
Merge branch 'jk/test-mktemp-leakfix'
Test leakfix. * jk/test-mktemp-leakfix: test-mktemp: plug memory and descriptor leaks
-rw-r--r--t/helper/test-mktemp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/t/helper/test-mktemp.c b/t/helper/test-mktemp.c
index 2290688940..da195640a9 100644
--- a/t/helper/test-mktemp.c
+++ b/t/helper/test-mktemp.c
@@ -6,10 +6,16 @@
int cmd__mktemp(int argc, const char **argv)
{
+ char *template;
+ int fd;
+
if (argc != 2)
usage("Expected 1 parameter defining the temporary file template");
+ template = xstrdup(argv[1]);
- xmkstemp(xstrdup(argv[1]));
+ fd = xmkstemp(template);
+ close(fd);
+ free(template);
return 0;
}