Fixed error handling of OSS audio plugin.

This commit is contained in:
Armin Novak 2015-09-01 11:39:56 +02:00
parent cb7927756d
commit 7cd3da9699

View File

@ -173,10 +173,10 @@ static void* audin_oss_thread_func(void* arg)
char dev_name[PATH_MAX] = "/dev/dsp";
char mixer_name[PATH_MAX] = "/dev/mixer";
int pcm_handle = -1, mixer_handle;
BYTE* buffer = NULL, *encoded_data;
BYTE* buffer = NULL, *encoded_data = NULL;
int tmp, buffer_size, encoded_size;
AudinOSSDevice* oss = (AudinOSSDevice*)arg;
UINT error;
UINT error = 0;
DWORD status;
if (arg == NULL)
@ -256,7 +256,7 @@ static void* audin_oss_thread_func(void* arg)
OSS_LOG_ERR("SNDCTL_DSP_SETFRAGMENT failed", errno);
buffer_size = (oss->FramesPerPacket * oss->format.nChannels * (oss->format.wBitsPerSample / 8));
buffer = (BYTE*)malloc((buffer_size + sizeof(void*)));
buffer = (BYTE*)calloc((buffer_size + sizeof(void*)), sizeof(BYTE));
if (NULL == buffer)
{
@ -265,7 +265,6 @@ static void* audin_oss_thread_func(void* arg)
goto err_out;
}
ZeroMemory(buffer, buffer_size);
freerdp_dsp_context_reset_adpcm(oss->dsp_context);
while (1)
@ -301,7 +300,7 @@ static void* audin_oss_thread_func(void* arg)
buffer, buffer_size, oss->format.nChannels, oss->format.nBlockAlign))
{
error = ERROR_INTERNAL_ERROR;
break;
goto err_out;
}
encoded_data = oss->dsp_context->adpcm_buffer;
encoded_size = oss->dsp_context->adpcm_size;
@ -311,7 +310,7 @@ static void* audin_oss_thread_func(void* arg)
buffer, buffer_size, oss->format.nChannels, oss->format.nBlockAlign))
{
error = ERROR_INTERNAL_ERROR;
break;
goto err_out;
}
encoded_data = oss->dsp_context->adpcm_buffer;
encoded_size = oss->dsp_context->adpcm_size;