From cceda2c16ec825efdc907f64d109c90546d2a309 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 2 Feb 2022 21:13:10 +0600 Subject: [PATCH] Fix brief extreme noise on hard resets --- src/sound/sound.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sound/sound.c b/src/sound/sound.c index b92062665..9ba4fb3df 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -344,9 +344,9 @@ sound_realloc_buffers(void) free(outbuffer_ex_int16); if (sound_is_float) - outbuffer_ex = malloc(SOUNDBUFLEN * 2 * sizeof(float)); + outbuffer_ex = calloc(SOUNDBUFLEN * 2, sizeof(float)); else - outbuffer_ex_int16 = malloc(SOUNDBUFLEN * 2 * sizeof(int16_t)); + outbuffer_ex_int16 = calloc(SOUNDBUFLEN * 2, sizeof(int16_t)); } @@ -359,7 +359,7 @@ sound_init(void) outbuffer_ex = NULL; outbuffer_ex_int16 = NULL; - outbuffer = malloc(SOUNDBUFLEN * 2 * sizeof(int32_t)); + outbuffer = calloc(SOUNDBUFLEN * 2, sizeof(int32_t)); for (i = 0; i < CDROM_NUM; i++) { if (cdrom[i].bus_type != CDROM_BUS_DISABLED)