Fix memory leak in error path.

This commit is contained in:
Robert Reif 2005-03-15 15:39:03 +00:00 committed by Alexandre Julliard
parent cf4d0d9707
commit 8b55b76daf
2 changed files with 6 additions and 1 deletions

View File

@ -1458,7 +1458,11 @@ DWORD WINAPI mciSendStringA(LPCSTR lpstrCommand, LPSTR lpstrRet,
if (lpstrRet)
{
lpwstrRet = HeapAlloc(GetProcessHeap(), 0, uRetLen * sizeof(WCHAR));
if (!lpwstrRet) return MCIERR_OUT_OF_MEMORY;
if (!lpwstrRet) {
WARN("no memory\n");
HeapFree( GetProcessHeap(), 0, lpwstrCommand );
return MCIERR_OUT_OF_MEMORY;
}
}
ret = mciSendStringW(lpwstrCommand, lpwstrRet, uRetLen, hwndCallback);
if (lpwstrRet)

View File

@ -166,6 +166,7 @@ static DWORD wodOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
if (dwFlags & WAVE_MAPPED) {
if (lpDesc->uMappedDeviceID >= ndhi) {
WARN("invalid parameter: dwFlags WAVE_MAPPED\n");
HeapFree(GetProcessHeap(), 0, wom);
return MMSYSERR_INVALPARAM;
}
ndlo = lpDesc->uMappedDeviceID;