aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tool_metalink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tool_metalink.c b/src/tool_metalink.c
index 7f46bb3d4..5873adf6a 100644
--- a/src/tool_metalink.c
+++ b/src/tool_metalink.c
@@ -621,8 +621,10 @@ static int check_hash(const char *filename,
}
result = malloc(digest_def->dparams->digest_resultlen);
- if(!result)
+ if(!result) {
+ close(fd);
return -1;
+ }
while(1) {
unsigned char buf[4096];
ssize_t len = read(fd, buf, sizeof(buf));