metalink: fix resource leak in OOM

Coverity CID 1288826
This commit is contained in:
Daniel Stenberg 2015-03-19 09:07:11 +01:00
parent 8ecfaad2cc
commit 1977ff811d

View File

@ -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));