From: Pierre Phaneuf Date: Fri, 28 May 2010 02:37:09 +0000 (-0400) Subject: Close the file in evutil_read_file whether there's an error or not. X-Git-Tag: release-2.0.6-rc~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0798dd1247407fcbae7c8401a41a082b64060e1d;p=libevent 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. --- 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; }