Commit d604b4bd authored by Alexandre Julliard's avatar Alexandre Julliard

Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbeyj@wpi.edu>

Fixed memory leak in waveOutOpen/waveOutClose.
parent 610b001d
...@@ -3288,6 +3288,12 @@ UINT16 WINAPI waveOutOpen16(HWAVEOUT16* lphWaveOut, UINT16 uDeviceID, ...@@ -3288,6 +3288,12 @@ UINT16 WINAPI waveOutOpen16(HWAVEOUT16* lphWaveOut, UINT16 uDeviceID,
if (dwFlags & WAVE_FORMAT_QUERY) { if (dwFlags & WAVE_FORMAT_QUERY) {
TRACE(mmsys, "End of WAVE_FORMAT_QUERY !\n"); TRACE(mmsys, "End of WAVE_FORMAT_QUERY !\n");
dwRet = waveOutClose(hWaveOut); dwRet = waveOutClose(hWaveOut);
if (lphWaveOut) *lphWaveOut = 0;
}
else if (dwRet != MMSYSERR_NOERROR)
{
USER_HEAP_FREE(hWaveOut);
if (lphWaveOut) *lphWaveOut = 0;
} }
return dwRet; return dwRet;
} }
...@@ -3306,12 +3312,15 @@ UINT WINAPI waveOutClose(HWAVEOUT hWaveOut) ...@@ -3306,12 +3312,15 @@ UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
UINT16 WINAPI waveOutClose16(HWAVEOUT16 hWaveOut) UINT16 WINAPI waveOutClose16(HWAVEOUT16 hWaveOut)
{ {
LPWAVEOPENDESC lpDesc; LPWAVEOPENDESC lpDesc;
DWORD dwRet = 0;
TRACE(mmsys, "(%04X)\n", hWaveOut); TRACE(mmsys, "(%04X)\n", hWaveOut);
lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut); lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
if (lpDesc == NULL) return MMSYSERR_INVALHANDLE; if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
return wodMessage(lpDesc->uDeviceID, WODM_CLOSE, lpDesc->dwInstance, 0L, 0L); dwRet = wodMessage(lpDesc->uDeviceID, WODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
USER_HEAP_FREE(hWaveOut);
return dwRet;
} }
/************************************************************************** /**************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment