diff options
author | Andrew Kurushin | 2010-10-19 15:31:07 +0000 |
---|---|---|
committer | Andrew Kurushin | 2010-10-19 15:31:07 +0000 |
commit | 0e7abce271c218faa6ae19059207fed5d61b0ef8 (patch) | |
tree | e2df8762901d0d45dba9f6d1a6c88c817b44228f /engines/saga/sprite.cpp | |
parent | f8c72439383c6ea6324d03fa4c9e067a33af2235 (diff) | |
download | scummvm-rg350-0e7abce271c218faa6ae19059207fed5d61b0ef8.tar.gz scummvm-rg350-0e7abce271c218faa6ae19059207fed5d61b0ef8.tar.bz2 scummvm-rg350-0e7abce271c218faa6ae19059207fed5d61b0ef8.zip |
SAGA: fix submit 53486 "Added sanity checks for realloc() calls - bug report #3087852". zero count realloc may return NULL as valid value
svn-id: r53614
Diffstat (limited to 'engines/saga/sprite.cpp')
-rw-r--r-- | engines/saga/sprite.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index 969faae737..a62f7c57eb 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -116,13 +116,10 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) { newSpriteCount = spriteList.spriteCount + spriteCount; SpriteInfo *tmp = (SpriteInfo *)realloc(spriteList.infoList, newSpriteCount * sizeof(*spriteList.infoList)); - if (tmp) + if ((tmp != NULL) || (newSpriteCount == 0)) { spriteList.infoList = tmp; - else + } else { error("Sprite::loadList(): Error while reallocating memory"); - - if (spriteList.infoList == NULL) { - memoryError("Sprite::loadList"); } spriteList.spriteCount = newSpriteCount; |