Commit 1d10cf85 authored by Teng Qin's avatar Teng Qin Committed by Facebook Github Bot

ElfFile: unmap on init error

Summary: Currently for `ElfFile::openNoThrow`, if `init` fails (due to mal-formatted content etc.) it won't unmap and close the file. They will only be unmapped / closed on destruction. This Diff calls `reset()` on that case.

Reviewed By: yfeldblum

Differential Revision: D9997690

fbshipit-source-id: c30907fb793c813a5ad40d249919dd1752a2d711
parent fc36aa9f
......@@ -99,6 +99,7 @@ int ElfFile::openNoThrow(
return kSystemError;
}
if (!init(msg)) {
reset();
errno = EINVAL;
return kInvalidElfFile;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment