Skip to content

Commit

Permalink
[libFuzzer] fix missing close on opened file
Browse files Browse the repository at this point in the history
Summary:
When running the standalone main on a large corpus, I eventually get a
EMFILE error ("Too many open files").

Patch by Paul Chaignon

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: lebedev.ri, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

Differential Revision: https://reviews.llvm.org/D58622

llvm-svn: 354918
  • Loading branch information
vitalybuka committed Feb 26, 2019
1 parent 01706bd commit 9b6135b
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -32,6 +32,7 @@ int main(int argc, char **argv) {
fseek(f, 0, SEEK_SET);
unsigned char *buf = (unsigned char*)malloc(len);
size_t n_read = fread(buf, 1, len, f);
fclose(f);
assert(n_read == len);
LLVMFuzzerTestOneInput(buf, len);
free(buf);
Expand Down

0 comments on commit 9b6135b

Please sign in to comment.