summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-08-30 08:47:04 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-08-30 09:02:49 -0400
commit036be15070bf7384f9391ddd52d1fc084b1ef8da (patch)
tree75985fb2633b8b5dd711fed4e650869be4318a7b
parent9191ef70e22ec8e6eb102c55147b47ce49a2b633 (diff)
downloadlibgit2-036be15070bf7384f9391ddd52d1fc084b1ef8da.tar.gz
hashsig: close fd on error
-rw-r--r--src/hashsig.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hashsig.c b/src/hashsig.c
index 43310ca48..6b4fb8352 100644
--- a/src/hashsig.c
+++ b/src/hashsig.c
@@ -286,8 +286,10 @@ int git_hashsig_create_fromfile(
return fd;
}
- if ((error = hashsig_in_progress_init(&prog, sig)) < 0)
+ if ((error = hashsig_in_progress_init(&prog, sig)) < 0) {
+ p_close(fd);
return error;
+ }
while (!error) {
if ((buflen = p_read(fd, buf, sizeof(buf))) <= 0) {