[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
llvm-svn: 354918
GitOrigin-RevId: 9b6135bf2a7aa2b9a79818671a5f12a98a41349f
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);