aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/sfx/softseq/amiga.cpp4
-rw-r--r--engines/sword2/render.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp
index fba437d306..5a960ad1e0 100644
--- a/engines/sci/sfx/softseq/amiga.cpp
+++ b/engines/sci/sfx/softseq/amiga.cpp
@@ -433,7 +433,7 @@ MidiDriver_Amiga::Instrument *MidiDriver_Amiga::readInstrument(Common::File &fil
if (file.read(instrument->samples, size) < (unsigned int)size) {
warning("[sfx:seq:amiga] failed to read instrument samples");
free(instrument->samples);
- free(instrument);
+ delete instrument;
return NULL;
}
@@ -449,7 +449,7 @@ MidiDriver_Amiga::Instrument *MidiDriver_Amiga::readInstrument(Common::File &fil
if (seg_size[1] < 0) {
warning("[sfx:seq:amiga] invalid looping point");
free(instrument->samples);
- free(instrument);
+ delete instrument;
return NULL;
}
diff --git a/engines/sword2/render.cpp b/engines/sword2/render.cpp
index 6123986367..05b50f189e 100644
--- a/engines/sword2/render.cpp
+++ b/engines/sword2/render.cpp
@@ -596,8 +596,10 @@ int32 Screen::initialisePsxBackgroundLayer(byte *parallax) {
return RDERR_OUTOFMEMORY;
_blockSurfaces[_layer] = (BlockSurface **)calloc(_xBlocks[_layer] * _yBlocks[_layer], sizeof(BlockSurface *));
- if (!_blockSurfaces[_layer])
+ if (!_blockSurfaces[_layer]) {
+ free(tileChunk);
return RDERR_OUTOFMEMORY;
+ }
// Group PSX background (64x32, when stretched vertically) tiles together,
// to make them compatible with pc version (composed by 64x64 tiles)