Skip to content

Commit

Permalink
Fixed uninitialized return and early resource cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
akallabeth committed May 4, 2018
1 parent fb032f9 commit 87c19b3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions channels/rdpsnd/client/rdpsnd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ static UINT rdpsnd_treat_wave(rdpsndPlugin* rdpsnd, wStream* s, size_t size)
{
BYTE* data;
AUDIO_FORMAT* format;
UINT status;
DWORD end;
DWORD diffMS;
UINT latency = 0;
Expand All @@ -488,20 +487,19 @@ static UINT rdpsnd_treat_wave(rdpsndPlugin* rdpsnd, wStream* s, size_t size)

if (rdpsnd->device && rdpsnd->attached)
{
UINT status = CHANNEL_RC_OK;
wStream* pcmData = StreamPool_Take(rdpsnd->pool, 4096);

if (rdpsnd->device->FormatSupported(rdpsnd->device, format))
{
latency = IFCALLRESULT(0, rdpsnd->device->Play, rdpsnd->device, data, size);
status = CHANNEL_RC_OK;
}
else if (freerdp_dsp_decode(rdpsnd->dsp_context, format, data, size, pcmData))
{
Stream_SealLength(pcmData);
latency = IFCALLRESULT(0, rdpsnd->device->Play, rdpsnd->device, Stream_Buffer(pcmData),
Stream_Length(pcmData));
status = CHANNEL_RC_OK;
}
else
status = ERROR_INTERNAL_ERROR;

StreamPool_Return(rdpsnd->pool, pcmData);

Expand Down Expand Up @@ -1128,7 +1126,6 @@ static UINT rdpsnd_virtual_channel_event_initialized(rdpsndPlugin* rdpsnd,

return CHANNEL_RC_OK;
fail:
rdpsnd_virtual_channel_event_terminated(rdpsnd);
return ERROR_INTERNAL_ERROR;
}

Expand Down

0 comments on commit 87c19b3

Please sign in to comment.