Close the RWops if the filesystem fails to open a font.

This commit is contained in:
Wayward Heart 2024-08-02 06:43:12 -05:00
parent c20d770c2c
commit a8019c0a0e

View file

@ -209,7 +209,12 @@ _TTF_Font *SharedFontState::getFont(std::string family,
? req.regular.c_str() : req.other.c_str();
ops = SDL_AllocRW();
try{
shState->fileSystem().openReadRaw(*ops, path, true);
} catch (const Exception &e) {
SDL_FreeRW(ops);
throw e;
}
}
// FIXME 0.9 is guesswork at this point