channels: Fix memory leak and make log messages more precise

This commit is contained in:
Martin Fleisz 2020-01-08 13:31:20 +01:00 committed by akallabeth
parent ca2e578acc
commit 05a865281e
4 changed files with 18 additions and 10 deletions

View File

@ -1027,9 +1027,10 @@ UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
{
if ((error = audin_load_device_plugin(audin, audin->subsystem, args)))
{
WLog_Print(audin->log, WLOG_ERROR,
"audin_load_device_plugin %s failed with error %" PRIu32 "!",
audin->subsystem, error);
WLog_Print(
audin->log, WLOG_ERROR,
"Unable to load microphone redirection subsystem %s because of error %" PRIu32 "",
audin->subsystem, error);
goto out;
}
}
@ -1064,7 +1065,7 @@ UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
{
/* If we have no audin device do not register plugin but still return OK or the client will
* just disconnect due to a missing microphone. */
WLog_Print(audin->log, WLOG_ERROR, "no sound device.");
WLog_Print(audin->log, WLOG_ERROR, "No microphone device could be found.");
error = CHANNEL_RC_OK;
goto out;
}

View File

@ -465,7 +465,10 @@ UINT freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEn
UINT error;
if (waveInGetNumDevs() == 0)
{
WLog_Print(winmm->log, WLOG_ERROR, "No microphone available!");
return ERROR_DEVICE_NOT_AVAILABLE;
}
winmm = (AudinWinmmDevice*)calloc(1, sizeof(AudinWinmmDevice));

View File

@ -851,7 +851,7 @@ static UINT rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
{
if ((status = rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %" PRIu32 "",
WLog_ERR(TAG, "Unable to load sound playback subsystem %s because of error %" PRIu32 "",
rdpsnd->subsystem, status);
return status;
}
@ -866,7 +866,8 @@ static UINT rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
const char* device_name = backends[x].device;
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %" PRIu32 "",
WLog_ERR(TAG,
"Unable to load sound playback subsystem %s because of error %" PRIu32 "",
subsystem_name, status);
if (!rdpsnd->device)

View File

@ -303,13 +303,16 @@ UINT freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS p
{
ADDIN_ARGV* args;
rdpsndWinmmPlugin* winmm;
winmm = (rdpsndWinmmPlugin*)calloc(1, sizeof(rdpsndWinmmPlugin));
if (!winmm)
return CHANNEL_RC_NO_MEMORY;
if (waveOutGetNumDevs() == 0)
{
WLog_Print(winmm->log, WLOG_ERROR, "No sound playback device available!");
return ERROR_DEVICE_NOT_AVAILABLE;
}
winmm = (rdpsndWinmmPlugin*)calloc(1, sizeof(rdpsndWinmmPlugin));
if (!winmm)
return CHANNEL_RC_NO_MEMORY;
winmm->device.Open = rdpsnd_winmm_open;
winmm->device.FormatSupported = rdpsnd_winmm_format_supported;