[libFuzzer] fix missing close on opened file
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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer@354918 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/standalone/StandaloneFuzzTargetMain.c b/standalone/StandaloneFuzzTargetMain.c
index 1d12172..efe512c 100644
--- a/standalone/StandaloneFuzzTargetMain.c
+++ b/standalone/StandaloneFuzzTargetMain.c
@@ -32,6 +32,7 @@
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);