From 0798dd1247407fcbae7c8401a41a082b64060e1d Mon Sep 17 00:00:00 2001 From: Pierre Phaneuf Date: Thu, 27 May 2010 22:37:09 -0400 Subject: [PATCH] Close the file in evutil_read_file whether there's an error or not. evutil_read_file would close the file if there was an error, but not if things went normally. --- evutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evutil.c b/evutil.c index 1dfc427a..d0621bfa 100644 --- a/evutil.c +++ b/evutil.c @@ -127,8 +127,8 @@ evutil_read_file(const char *filename, char **content_out, size_t *len_out, break; EVUTIL_ASSERT(read_so_far < st.st_size); } + close(fd); if (r < 0) { - close(fd); mm_free(mem); return -2; }