aboutsummaryrefslogtreecommitdiff
path: root/graphics/font.cpp
diff options
context:
space:
mode:
authorMax Horn2009-07-14 18:24:20 +0000
committerMax Horn2009-07-14 18:24:20 +0000
commit6b98c4c4e7a23089a6cccba573a1c3afd909f52d (patch)
tree7bca862b8b3035e1b9ff054f67b8c83c891265c8 /graphics/font.cpp
parent96abaaea6d06dae9bc1a48dc3b3afc936a92468b (diff)
downloadscummvm-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.cpp11
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);