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,8 +1027,9 @@ UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
{ {
if ((error = audin_load_device_plugin(audin, audin->subsystem, args))) if ((error = audin_load_device_plugin(audin, audin->subsystem, args)))
{ {
WLog_Print(audin->log, WLOG_ERROR, WLog_Print(
"audin_load_device_plugin %s failed with error %" PRIu32 "!", audin->log, WLOG_ERROR,
"Unable to load microphone redirection subsystem %s because of error %" PRIu32 "",
audin->subsystem, error); audin->subsystem, error);
goto out; 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 /* 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. */ * 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; error = CHANNEL_RC_OK;
goto out; goto out;
} }

View File

@ -465,7 +465,10 @@ UINT freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEn
UINT error; UINT error;
if (waveInGetNumDevs() == 0) if (waveInGetNumDevs() == 0)
{
WLog_Print(winmm->log, WLOG_ERROR, "No microphone available!");
return ERROR_DEVICE_NOT_AVAILABLE; return ERROR_DEVICE_NOT_AVAILABLE;
}
winmm = (AudinWinmmDevice*)calloc(1, sizeof(AudinWinmmDevice)); 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))) 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); rdpsnd->subsystem, status);
return status; return status;
} }
@ -866,7 +866,8 @@ static UINT rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
const char* device_name = backends[x].device; const char* device_name = backends[x].device;
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args))) 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); subsystem_name, status);
if (!rdpsnd->device) if (!rdpsnd->device)

View File

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