From 1977ff811d361d97f1c195c60b9a2dc94b9ebc59 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 19 Mar 2015 09:07:11 +0100 Subject: metalink: fix resource leak in OOM Coverity CID 1288826 --- src/tool_metalink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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)); -- cgit v1.2.3