aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/backends/winmm.c11
1 files changed, 4 insertions, 7 deletions
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)