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.
This commit is contained in:
Pierre Phaneuf 2010-05-27 22:37:09 -04:00
parent c21c663161
commit 0798dd1247

View File

@ -127,8 +127,8 @@ evutil_read_file(const char *filename, char **content_out, size_t *len_out,
break; break;
EVUTIL_ASSERT(read_so_far < st.st_size); EVUTIL_ASSERT(read_so_far < st.st_size);
} }
close(fd);
if (r < 0) { if (r < 0) {
close(fd);
mm_free(mem); mm_free(mem);
return -2; return -2;
} }