diff options
author | Robin Watts | 2008-02-23 18:57:49 +0000 |
---|---|---|
committer | Robin Watts | 2008-02-23 18:57:49 +0000 |
commit | 1cf9fc944a8488e928da49208118a32ea10c3c62 (patch) | |
tree | 4ec71f9f03379f410514fb5e51a91c52ee3772bc /engines | |
parent | 39c348e4d25d49787930fb2dc178edaf4fafadec (diff) | |
download | scummvm-rg350-1cf9fc944a8488e928da49208118a32ea10c3c62.tar.gz scummvm-rg350-1cf9fc944a8488e928da49208118a32ea10c3c62.tar.bz2 scummvm-rg350-1cf9fc944a8488e928da49208118a32ea10c3c62.zip |
Make codec47 cope with failed mallocs.
Not the nicest result in the world, but better than crashing and burning...
svn-id: r30934
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/smush/codec47.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp index 8dd8b0cffe..4bf2581365 100644 --- a/engines/scumm/smush/codec47.cpp +++ b/engines/scumm/smush/codec47.cpp @@ -531,8 +531,10 @@ Codec47Decoder::Codec47Decoder(int width, int height) { _height = height; _tableBig = (byte *)malloc(256 * 388); _tableSmall = (byte *)malloc(256 * 128); - makeTablesInterpolation(4); - makeTablesInterpolation(8); + if ((_tableBig != NULL) && (_tableSmall != NULL)) { + makeTablesInterpolation(4); + makeTablesInterpolation(8); + } _frameSize = _width * _height; _deltaSize = _frameSize * 3; @@ -562,6 +564,9 @@ Codec47Decoder::~Codec47Decoder() { } bool Codec47Decoder::decode(byte *dst, const byte *src) { + if ((_tableBig == NULL) || (_tableSmall == NULL) || (_deltaBuf == NULL)) + return false; + _offset1 = _deltaBufs[1] - _curBuf; _offset2 = _deltaBufs[0] - _curBuf; |