aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-03-19 09:07:11 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-19 09:08:08 +0100
commit1977ff811d361d97f1c195c60b9a2dc94b9ebc59 (patch)
tree30ff8f1d2a0646c25bdaea7efc276c5fb8530659
parent8ecfaad2cca88a89419c688ec397d8724aec1936 (diff)
metalink: fix resource leak in OOM
Coverity CID 1288826
-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));