Merge branch 'jk/test-mktemp-leakfix'

Test leakfix.

* jk/test-mktemp-leakfix:
  test-mktemp: plug memory and descriptor leaks
main
Junio C Hamano 2025-11-26 10:32:41 -08:00
commit 24ddb3f1fc
1 changed files with 7 additions and 1 deletions

View File

@ -6,10 +6,16 @@


int cmd__mktemp(int argc, const char **argv) int cmd__mktemp(int argc, const char **argv)
{ {
char *template;
int fd;

if (argc != 2) if (argc != 2)
usage("Expected 1 parameter defining the temporary file template"); 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; return 0;
} }