aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/sprite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/saga/sprite.cpp')
-rw-r--r--engines/saga/sprite.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp
index c1a9846b47..969faae737 100644
--- a/engines/saga/sprite.cpp
+++ b/engines/saga/sprite.cpp
@@ -115,7 +115,12 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) {
oldSpriteCount = spriteList.spriteCount;
newSpriteCount = spriteList.spriteCount + spriteCount;
- spriteList.infoList = (SpriteInfo *)realloc(spriteList.infoList, newSpriteCount * sizeof(*spriteList.infoList));
+ SpriteInfo *tmp = (SpriteInfo *)realloc(spriteList.infoList, newSpriteCount * sizeof(*spriteList.infoList));
+ if (tmp)
+ spriteList.infoList = tmp;
+ else
+ error("Sprite::loadList(): Error while reallocating memory");
+
if (spriteList.infoList == NULL) {
memoryError("Sprite::loadList");
}