From a45c3f26b6d06822516dd98112a0a4393bcdd51e Mon Sep 17 00:00:00 2001 From: gzaffin Date: Sun, 8 Oct 2023 16:45:38 +0200 Subject: [PATCH] Fix Issue segfault #2 . --- eupplayer_townsEmulator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eupplayer_townsEmulator.cpp b/eupplayer_townsEmulator.cpp index c91f7a0..4d809c9 100644 --- a/eupplayer_townsEmulator.cpp +++ b/eupplayer_townsEmulator.cpp @@ -1355,7 +1355,7 @@ void EUP_TownsEmulator::nextTick() } #endif // _MSC_VER #if defined ( __MINGW32__ ) - int *buf0 = new int[buflen]; + int *buf0 = new int[buflen * _outputSampleChannels]; if (nullptr == buf0) { fprintf(stderr, "heap allocation problem.\n"); fflush(stderr); @@ -1363,7 +1363,7 @@ void EUP_TownsEmulator::nextTick() } #endif // __MINGW32__ #if defined ( __GNUC__ ) && !defined ( __MINGW32__ ) - int buf0[buflen]; + int buf0[buflen * _outputSampleChannels]; #endif // __GNUC__ memset(buf0, 0, sizeof(buf0[0]) * buflen * _outputSampleChannels);