This is an archive of the discontinued LLVM Phabricator instance.

[libFuzzer] fix missing close on opened file
ClosedPublic

Authored by pchaigno on Feb 25 2019, 7:24 AM.

Details

Summary

When running the standalone main on a large corpus, I eventually get a
EMFILE error ("Too many open files").

Patch by Paul Chaignon

Diff Detail

Repository
rL LLVM

Event Timeline

pchaigno created this revision.Feb 25 2019, 7:24 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 25 2019, 7:24 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
lebedev.ri added inline comments.
lib/fuzzer/standalone/StandaloneFuzzTargetMain.c
34 ↗(On Diff #188152)

You probably can even close it right after fread?

pchaigno marked an inline comment as done.Feb 25 2019, 7:48 AM
pchaigno added inline comments.
lib/fuzzer/standalone/StandaloneFuzzTargetMain.c
34 ↗(On Diff #188152)

Yes. I wasn't sure what was best: closing as soon as possible or grouping the "cleaning actions".

pchaigno updated this revision to Diff 188190.Feb 25 2019, 8:34 AM
pchaigno marked an inline comment as not done.

Close the file as soon as possible.

vitalybuka accepted this revision.Feb 25 2019, 11:22 AM
This revision is now accepted and ready to land.Feb 25 2019, 11:22 AM

I do not have the necessary commit access to commit this change myself.

vitalybuka edited the summary of this revision. (Show Details)Feb 26 2019, 10:54 AM
This revision was automatically updated to reflect the committed changes.