diff options
author | Max Horn | 2009-07-14 18:24:20 +0000 |
---|---|---|
committer | Max Horn | 2009-07-14 18:24:20 +0000 |
commit | 6b98c4c4e7a23089a6cccba573a1c3afd909f52d (patch) | |
tree | 7bca862b8b3035e1b9ff054f67b8c83c891265c8 /graphics/font.cpp | |
parent | 96abaaea6d06dae9bc1a48dc3b3afc936a92468b (diff) | |
download | scummvm-rg350-6b98c4c4e7a23089a6cccba573a1c3afd909f52d.tar.gz scummvm-rg350-6b98c4c4e7a23089a6cccba573a1c3afd909f52d.tar.bz2 scummvm-rg350-6b98c4c4e7a23089a6cccba573a1c3afd909f52d.zip |
Got rid of some more ioFailed uses (also fixed a potential leak in graphics/font.cpp, and handle eos correctly in the FLAC code)
svn-id: r42488
Diffstat (limited to 'graphics/font.cpp')
-rw-r--r-- | graphics/font.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/graphics/font.cpp b/graphics/font.cpp index bfc6dea0c1..4d322be081 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -733,6 +733,14 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { } } + if (stream.err() || stream.eos()) { + free(data->bits); + free(data->offset); + free(data->width); + free(data); + return 0; + } + FontDesc desc; desc.name = data->name; desc.maxwidth = data->maxwidth; @@ -752,8 +760,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { desc.bits_size = data->bits_size; font = new NewFont(desc, data); - if (!font || stream.err()) { - delete font; + if (!font) { free(data->bits); free(data->offset); free(data->width); |