If open() succeeds but fstat() fails, the file descriptor is not closed, causing a resource leak. This patch adds a close(fd) call in the failure path after fstat() to ensure proper resource cleanup. Signed-off-by: Hoyoung Lee <lhywkd22@xxxxxxxxx> --- t/helper/test-delta.c | 1 + 1 file changed, 1 insertion(+) diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c index 6bc787a474..103bf7f3e9 100644 --- a/t/helper/test-delta.c +++ b/t/helper/test-delta.c @@ -31,6 +31,7 @@ int cmd__delta(int argc, const char **argv) fd = open(argv[2], O_RDONLY); if (fd < 0 || fstat(fd, &st)) { perror(argv[2]); + close(fd); return 1; } from_size = st.st_size; -- 2.34.1