aboutsummaryrefslogtreecommitdiff
path: root/engines/sword2/sprite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword2/sprite.cpp')
-rw-r--r--engines/sword2/sprite.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/sword2/sprite.cpp b/engines/sword2/sprite.cpp
index 5a45c19ab6..7d45f8df4e 100644
--- a/engines/sword2/sprite.cpp
+++ b/engines/sword2/sprite.cpp
@@ -528,8 +528,11 @@ int32 Screen::drawSprite(SpriteInfo *s) {
decompData = decompressHIF(s->data, tempBuf);
// Check that we correctly decompressed data
- if (!decompData)
+ if (!decompData) {
+ free(tempBuf);
+
return RDERR_DECOMPRESSION;
+ }
s->w = (decompData / (s->h / 2)) * 2;
byte *tempBuf2 = (byte *)malloc(s->w * s->h * 10);
@@ -571,8 +574,11 @@ int32 Screen::drawSprite(SpriteInfo *s) {
uint32 decompData = decompressHIF(s->data, tempBuf);
// Check that we correctly decompressed data
- if (!decompData)
+ if (!decompData) {
+ free(tempBuf);
+
return RDERR_DECOMPRESSION;
+ }
s->w = (decompData / (s->h / 2));
sprite = (byte *)malloc(s->w * s->h);