WASAPI: calloc stream buffers to ensure unused channels are left silent
authorMarcus Tomlinson <themarcustomlinson@gmail.com>
Sun, 27 Jan 2019 16:25:03 +0000 (16:25 +0000)
committerMarcus Tomlinson <themarcustomlinson@gmail.com>
Sun, 27 Jan 2019 16:25:03 +0000 (16:25 +0000)
RtAudio.cpp

index 9927b260123a7616ed88cb5efb2a7346eaa53ffa..babe13b4c82bf9c5e3a03d5e816c7ea15047a82a 100644 (file)
@@ -5191,8 +5191,8 @@ void RtApiWasapi::wasapiThread()
   }
 
   convBuffSize *= 2; // allow overflow for *SrRatio remainders
-  convBuffer = ( char* ) malloc( convBuffSize );
-  stream_.deviceBuffer = ( char* ) malloc( deviceBuffSize );
+  convBuffer = ( char* ) calloc( convBuffSize, 1 );
+  stream_.deviceBuffer = ( char* ) calloc( deviceBuffSize, 1 );
   if ( !convBuffer || !stream_.deviceBuffer ) {
     errorType = RtAudioError::MEMORY_ERROR;
     errorText = "RtApiWasapi::wasapiThread: Error allocating device buffer memory.";