Set pEntryPointsEx->ppInterface NULL on error.

This commit is contained in:
Armin Novak 2016-09-26 12:12:14 +02:00
parent 88a3b8dd76
commit 64590e7e89
6 changed files with 111 additions and 86 deletions

View File

@ -1235,7 +1235,7 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{ {
UINT rc; UINT rc;
cliprdrPlugin* cliprdr; cliprdrPlugin* cliprdr;
CliprdrClientContext* context; CliprdrClientContext* context = NULL;
CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx; CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx;
cliprdr = (cliprdrPlugin*) calloc(1, sizeof(cliprdrPlugin)); cliprdr = (cliprdrPlugin*) calloc(1, sizeof(cliprdrPlugin));
@ -1298,6 +1298,9 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{ {
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]", WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
WTSErrorToString(rc), rc); WTSErrorToString(rc), rc);
if (context)
*(pEntryPointsEx->ppInterface) = NULL;
free(cliprdr->context); free(cliprdr->context);
free(cliprdr); free(cliprdr);
return FALSE; return FALSE;

View File

@ -1469,7 +1469,7 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{ {
UINT rc; UINT rc;
drdynvcPlugin* drdynvc; drdynvcPlugin* drdynvc;
DrdynvcClientContext* context; DrdynvcClientContext* context = NULL;
CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx; CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx;
drdynvc = (drdynvcPlugin*) calloc(1, sizeof(drdynvcPlugin)); drdynvc = (drdynvcPlugin*) calloc(1, sizeof(drdynvcPlugin));
@ -1519,6 +1519,9 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{ {
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]", WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
WTSErrorToString(rc), rc); WTSErrorToString(rc), rc);
if (context)
*(pEntryPointsEx->ppInterface) = NULL;
free(drdynvc->context); free(drdynvc->context);
free(drdynvc); free(drdynvc);
return FALSE; return FALSE;

View File

@ -1232,7 +1232,7 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{ {
UINT rc; UINT rc;
encomspPlugin* encomsp; encomspPlugin* encomsp;
EncomspClientContext* context; EncomspClientContext* context = NULL;
CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx; CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx;
BOOL isFreerdp = FALSE; BOOL isFreerdp = FALSE;
encomsp = (encomspPlugin*) calloc(1, sizeof(encomspPlugin)); encomsp = (encomspPlugin*) calloc(1, sizeof(encomspPlugin));
@ -1301,6 +1301,8 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
s_TLSPluginContext = encomsp; s_TLSPluginContext = encomsp;
return TRUE; return TRUE;
error_out: error_out:
if (context)
*(pEntryPointsEx->ppInterface) = NULL;
if (isFreerdp) if (isFreerdp)
free(encomsp->context); free(encomsp->context);

View File

@ -759,7 +759,7 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{ {
UINT rc; UINT rc;
railPlugin* rail; railPlugin* rail;
RailClientContext* context; RailClientContext* context = NULL;
CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx; CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx;
BOOL isFreerdp = FALSE; BOOL isFreerdp = FALSE;
rail = (railPlugin*) calloc(1, sizeof(railPlugin)); rail = (railPlugin*) calloc(1, sizeof(railPlugin));
@ -840,6 +840,9 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
return TRUE; return TRUE;
error_out: error_out:
if (context)
*(pEntryPointsEx->ppInterface) = NULL;
if (isFreerdp) if (isFreerdp)
free(rail->context); free(rail->context);

View File

@ -1460,6 +1460,12 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
UINT rc; UINT rc;
rdpsndPlugin* rdpsnd; rdpsndPlugin* rdpsnd;
CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx; CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx;
if (!pEntryPoints)
{
return FALSE;
}
rdpsnd = (rdpsndPlugin*) calloc(1, sizeof(rdpsndPlugin)); rdpsnd = (rdpsndPlugin*) calloc(1, sizeof(rdpsndPlugin));
if (!rdpsnd) if (!rdpsnd)

View File

@ -1034,6 +1034,12 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
remdeskPlugin* remdesk; remdeskPlugin* remdesk;
RemdeskClientContext* context = NULL; RemdeskClientContext* context = NULL;
CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx; CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx;
if (!pEntryPoints)
{
return FALSE;
}
remdesk = (remdeskPlugin*) calloc(1, sizeof(remdeskPlugin)); remdesk = (remdeskPlugin*) calloc(1, sizeof(remdeskPlugin));
if (!remdesk) if (!remdesk)
@ -1088,6 +1094,8 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
s_TLSPluginContext = remdesk; s_TLSPluginContext = remdesk;
return TRUE; return TRUE;
error_out: error_out:
if (context)
*(pEntryPointsEx->ppInterface) = NULL;
free(remdesk); free(remdesk);
free(context); free(context);
return FALSE; return FALSE;