diff --git a/Userland/Applications/SoundPlayer/M3UParser.cpp b/Userland/Applications/SoundPlayer/M3UParser.cpp index 9efb030168..19e3dd5cbc 100644 --- a/Userland/Applications/SoundPlayer/M3UParser.cpp +++ b/Userland/Applications/SoundPlayer/M3UParser.cpp @@ -7,6 +7,7 @@ #include "M3UParser.h" #include #include +#include #include M3UParser::M3UParser() @@ -19,6 +20,7 @@ NonnullOwnPtr M3UParser::from_file(const String path) VERIFY(!path.is_null() && !path.is_empty() && !path.is_whitespace()); parser->m_use_utf8 = path.ends_with(".m3u8", AK::CaseSensitivity::CaseInsensitive); FILE* file = fopen(path.characters(), "r"); + ScopeGuard file_guard = [&] { fclose(file); }; VERIFY(file != nullptr); fseek(file, 0, SEEK_END); size_t file_size = ftell(file);