Skip to content

Commit 24ddb3f

Browse files
committed
Merge branch 'jk/test-mktemp-leakfix'
Test leakfix. * jk/test-mktemp-leakfix: test-mktemp: plug memory and descriptor leaks
2 parents 370470e + 14b561e commit 24ddb3f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

t/helper/test-mktemp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@
66

77
int cmd__mktemp(int argc, const char **argv)
88
{
9+
char *template;
10+
int fd;
11+
912
if (argc != 2)
1013
usage("Expected 1 parameter defining the temporary file template");
14+
template = xstrdup(argv[1]);
1115

12-
xmkstemp(xstrdup(argv[1]));
16+
fd = xmkstemp(template);
1317

18+
close(fd);
19+
free(template);
1420
return 0;
1521
}

0 commit comments

Comments
 (0)