From 1cf9fc944a8488e928da49208118a32ea10c3c62 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Sat, 23 Feb 2008 18:57:49 +0000 Subject: Make codec47 cope with failed mallocs. Not the nicest result in the world, but better than crashing and burning... svn-id: r30934 --- engines/scumm/smush/codec47.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'engines/scumm/smush') 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; -- cgit v1.2.3