From 8ac9ff3ff0c7b4b3210b9826ece8bbd2ff0e4a5f Mon Sep 17 00:00:00 2001 From: qbix79 Date: Fri, 20 Jun 2008 13:29:45 +0000 Subject: [PATCH] Clear memory before using it. (the buffer is read to get the old value before adding a voice to it and clipping it) git-svn-id: https://svn.eduke32.com/eduke32@806 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/jaudiolib/multivoc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/source/jaudiolib/multivoc.c b/polymer/eduke32/source/jaudiolib/multivoc.c index 10c5351e6..d5457c474 100644 --- a/polymer/eduke32/source/jaudiolib/multivoc.c +++ b/polymer/eduke32/source/jaudiolib/multivoc.c @@ -2872,7 +2872,8 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb initprintf(" - Using %d byte mixing buffers\n", MixBufferSize); // Allocate mix buffer within 1st megabyte - ptr = (char *)malloc(TotalBufferSize + 8); // FIXME: temporarily fixes bounds error somewhere... + // use calloc to clear the memory for the first playback. + ptr = (char *)calloc(1,TotalBufferSize + 8); // FIXME: temporarily fixes bounds error somewhere... if (!ptr) { USRHOOKS_FreeMem(MV_Voices);