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
This commit is contained in:
parent
f8c7243938
commit
0e7abce271
4 changed files with 23 additions and 19 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue