From a7db3d3a0f55630953fd374f26d9e46575ef6dad Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 27 Jan 2022 17:43:48 +1100 Subject: [PATCH] [client] audio: check for malloc failure --- client/src/audio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/audio.c b/client/src/audio.c index 65c32a72..587fad01 100644 --- a/client/src/audio.c +++ b/client/src/audio.c @@ -421,10 +421,22 @@ void audio_playbackData(uint8_t * data, size_t size) } spiceData->periodFrames = frames; spiceData->framesIn = malloc(frames * audio.playback.stride); + if (!spiceData->framesIn) + { + DEBUG_ERROR("Failed to malloc framesIn"); + playbackStopNL(); + return; + } spiceData->framesOutSize = round(frames * 1.1); spiceData->framesOut = malloc(spiceData->framesOutSize * audio.playback.stride); + if (!spiceData->framesOut) + { + DEBUG_ERROR("Failed to malloc framesOut"); + playbackStopNL(); + return; + } } src_short_to_float_array((int16_t *) data, spiceData->framesIn,