From ccc2644e6b8a8af3ee923f4427a326df46f719ea Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 25 Aug 2011 11:33:13 -0700 Subject: Free the WaveIn buffers' data after unpreparing them all --- Alc/backends/winmm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'Alc/backends/winmm.c') diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c index 2a286259..0a186662 100644 --- a/Alc/backends/winmm.c +++ b/Alc/backends/winmm.c @@ -486,10 +486,10 @@ static void WinMMStopPlayback(ALCdevice *device) static ALCenum WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName) { WAVEFORMATEX wfexCaptureFormat; + ALbyte *BufferData = NULL; DWORD ulCapturedDataSize; WinMMData *pData = NULL; UINT lDeviceID = 0; - ALbyte *BufferData; ALint lBufferSize; MMRESULT res; ALuint i; @@ -605,14 +605,11 @@ failure: if(pData->hWaveThread) CloseHandle(pData->hWaveThread); - for(i = 0;i < 4;i++) + if(BufferData) { - if(pData->WaveBuffer[i].lpData) - { + for(i = 0;i < 4;i++) waveInUnprepareHeader(pData->hWaveHandle.In, &pData->WaveBuffer[i], sizeof(WAVEHDR)); - if(i == 0) - free(pData->WaveBuffer[i].lpData); - } + free(BufferData); } if(pData->pRing) -- cgit v1.2.3