Fixed NULL pointer checks.

This commit is contained in:
Armin Novak
2016-10-04 10:31:04 +02:00
parent ded84b1528
commit b03e47166e
2 changed files with 8 additions and 5 deletions

View File

@@ -224,10 +224,11 @@ static UINT audin_server_recv_formats(audin_server* audin, wStream* s,
return ERROR_INVALID_DATA;
}
audin->context.client_formats = malloc(audin->context.num_client_formats *
audin->context.client_formats = calloc(audin->context.num_client_formats,
sizeof(AUDIO_FORMAT));
ZeroMemory(audin->context.client_formats,
audin->context.num_client_formats * sizeof(AUDIO_FORMAT));
if (!audin->context.client_formats)
return ERROR_NOT_ENOUGH_MEMORY;
for (i = 0; i < audin->context.num_client_formats; i++)
{

View File

@@ -224,9 +224,12 @@ static void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
if (!rdpsnd->NumberOfServerFormats)
return;
rdpsnd->ClientFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) *
rdpsnd->ClientFormats = (AUDIO_FORMAT*) calloc(sizeof(AUDIO_FORMAT),
rdpsnd->NumberOfServerFormats);
if (!rdpsnd->ClientFormats)
return;
for (index = 0; index < (int) rdpsnd->NumberOfServerFormats; index++)
{
serverFormat = &rdpsnd->ServerFormats[index];
@@ -799,7 +802,6 @@ static UINT rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name,
{
PFREERDP_RDPSND_DEVICE_ENTRY entry;
FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
\
UINT error;
entry = (PFREERDP_RDPSND_DEVICE_ENTRY)
freerdp_load_channel_addin_entry("rdpsnd", (LPSTR) name, NULL, 0);