aboutsummaryrefslogtreecommitdiff
path: root/audio/decoders/voc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'audio/decoders/voc.cpp')
-rw-r--r--audio/decoders/voc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/audio/decoders/voc.cpp b/audio/decoders/voc.cpp
index 74ea4440a1..be53f945ac 100644
--- a/audio/decoders/voc.cpp
+++ b/audio/decoders/voc.cpp
@@ -118,7 +118,11 @@ static byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate,
debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
if (packing == 0) {
if (size) {
- ret_sound = (byte *)realloc(ret_sound, size + len);
+ byte *tmp = (byte *)realloc(ret_sound, size + len);
+ if (!tmp)
+ error("Cannot reallocate memory for VOC Data Block");
+
+ ret_sound = tmp;
} else {
ret_sound = (byte *)malloc(len);
}