Merge pull request #5869 from llyzs/winmm_fixes
rdpsnd/winmm: fix some memory issues.
This commit is contained in:
commit
1366abfbff
@ -478,9 +478,7 @@ static UINT rdpsnd_treat_wave(rdpsndPlugin* rdpsnd, wStream* s, size_t size)
|
||||
|
||||
end = GetTickCount64();
|
||||
diffMS = end - rdpsnd->wArrivalTime + latency;
|
||||
ts = rdpsnd->wTimeStamp + diffMS;
|
||||
if (ts > UINT16_MAX)
|
||||
ts = UINT16_MAX;
|
||||
ts = (rdpsnd->wTimeStamp + diffMS) % UINT16_MAX;
|
||||
return rdpsnd_send_wave_confirm_pdu(rdpsnd, (UINT16)ts, rdpsnd->cBlockNo);
|
||||
}
|
||||
|
||||
@ -741,7 +739,7 @@ static UINT rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args)
|
||||
if ((errno != 0) || (val > UINT16_MAX))
|
||||
return CHANNEL_RC_INITIALIZATION_ERROR;
|
||||
|
||||
rdpsnd->fixed_format->wFormatTag = val;
|
||||
rdpsnd->fixed_format->wFormatTag = (UINT16)val;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "rate")
|
||||
{
|
||||
@ -759,7 +757,7 @@ static UINT rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args)
|
||||
if ((errno != 0) || (val > UINT16_MAX))
|
||||
return CHANNEL_RC_INITIALIZATION_ERROR;
|
||||
|
||||
rdpsnd->fixed_format->nChannels = val;
|
||||
rdpsnd->fixed_format->nChannels = (UINT16)val;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "latency")
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ static void rdpsnd_winmm_close(rdpsndDevicePlugin* device)
|
||||
if (winmm->hThread)
|
||||
{
|
||||
WaitForSingleObject(winmm->hThread, INFINITE);
|
||||
CloseHandle(&winmm->hThread);
|
||||
CloseHandle(winmm->hThread);
|
||||
winmm->hThread = NULL;
|
||||
}
|
||||
}
|
||||
@ -266,7 +266,7 @@ static UINT rdpsnd_winmm_play(rdpsndDevicePlugin* device, const BYTE* data, size
|
||||
if (size > UINT32_MAX)
|
||||
return 0;
|
||||
|
||||
lpWaveHdr = malloc(sizeof(WAVEHDR));
|
||||
lpWaveHdr = (LPWAVEHDR)calloc(1, sizeof(WAVEHDR));
|
||||
if (!lpWaveHdr)
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user