t/helper/test-truncate: close file descriptor after truncation
Fix a resource leak where the file descriptor was not closed after truncating a file in t/helper/test-truncate.c. Signed-off-by: Hoyoung Lee <lhywkd22@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Hoyoung Lee committed
Jul 22, 2025 at 17:41 UTC
8cc19250b324c90f4283bcad488c8bbc756145c4
1 file changed
+3
t/helper/test-truncate.c
+3
@@ -21,5 +21,8 @@ int cmd__truncate(int argc, const char **argv)
21
22
if (ftruncate(fd, (off_t) sz) < 0)
23
die_errno("failed to truncate file");
24
+
25
+ close(fd);
26
+
27
return 0;
28
}