aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorJulien2011-06-04 06:46:40 +0800
committerJulien2011-06-23 15:11:36 +0800
commitc52cc849123ac4a6e4a6ce1f0880cb1cd95e23cd (patch)
tree57cbaaf240bd1177f6bf36257b55882508b1e88f /audio
parent2f200ac49322ff8ccd13c5e8b7a22abbf6ff2610 (diff)
downloadscummvm-rg350-c52cc849123ac4a6e4a6ce1f0880cb1cd95e23cd.tar.gz
scummvm-rg350-c52cc849123ac4a6e4a6ce1f0880cb1cd95e23cd.tar.bz2
scummvm-rg350-c52cc849123ac4a6e4a6ce1f0880cb1cd95e23cd.zip
AUDIO/BACKENDS/GRAPHICS: Add error checks after allocating memory with malloc
Diffstat (limited to 'audio')
-rw-r--r--audio/rate.cpp3
-rw-r--r--audio/softsynth/opl/mame.cpp2
2 files changed, 5 insertions, 0 deletions
diff --git a/audio/rate.cpp b/audio/rate.cpp
index 83abd6150b..0fc23a8a54 100644
--- a/audio/rate.cpp
+++ b/audio/rate.cpp
@@ -298,6 +298,9 @@ public:
_bufferSize = osamp;
}
+ if (!_buffer)
+ error("[CopyRateConverter::flow] Cannot allocate memory for temp buffer");
+
// Read up to 'osamp' samples into our temporary buffer
len = input.readBuffer(_buffer, osamp);
diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp
index 74699ba4c6..15e869ba33 100644
--- a/audio/softsynth/opl/mame.cpp
+++ b/audio/softsynth/opl/mame.cpp
@@ -725,6 +725,8 @@ static int OPLOpenTable(void) {
ENV_CURVE = (int *)malloc(sizeof(int) * (2*EG_ENT+1));
+ if (!ENV_CURVE)
+ error("[OPLOpenTable] Cannot allocate memory");
/* envelope counter -> envelope output table */
for (i=0; i < EG_ENT; i++) {