diff --git a/include/clopts.hh b/include/clopts.hh index 640c047..4e8683a 100644 --- a/include/clopts.hh +++ b/include/clopts.hh @@ -300,6 +300,7 @@ static file_data_type map_file( /// Read the file manually. auto f = std::fopen(path.data(), "rb"); if (not f) return err(path); + at_scope_exit _close_file = [&] { std::fclose(f); }; /// Get the file size. std::fseek(f, 0, SEEK_END);