[core] assert rdp->context

This commit is contained in:
akallabeth 2023-06-26 10:17:42 +02:00 committed by Martin Fleisz
parent 63c80423a9
commit 4d350978dd
3 changed files with 20 additions and 13 deletions

View File

@ -1742,7 +1742,10 @@ BOOL rdp_server_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
const CONNECTION_STATE cstate = rdp_get_state(rdp);
if (cstate >= CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT)
{
WINPR_ASSERT(rdp->context);
client = rdp->context->peer;
}
if (!rdp_is_active_peer_state(cstate))
{

View File

@ -542,12 +542,12 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
{
int reason = 0;
TerminateEventArgs e = { 0 };
rdpContext* context;
if (!mcs_recv_disconnect_provider_ultimatum(rdp->mcs, s, &reason))
return FALSE;
context = rdp->context;
rdpContext* context = rdp->context;
WINPR_ASSERT(context);
context->disconnectUltimatum = reason;
if (rdp->errorInfo == ERRINFO_SUCCESS)
@ -2169,6 +2169,8 @@ rdpRdp* rdp_new(rdpContext* context)
InitializeCriticalSection(&rdp->critical);
rdp->context = context;
WINPR_ASSERT(rdp->context);
flags = 0;
if (context->ServerMode)
@ -2636,6 +2638,7 @@ BOOL rdp_set_backup_settings(rdpRdp* rdp)
BOOL rdp_reset_runtime_settings(rdpRdp* rdp)
{
WINPR_ASSERT(rdp);
WINPR_ASSERT(rdp->context);
freerdp_settings_free(rdp->settings);
rdp->context->settings = rdp->settings = freerdp_settings_clone(rdp->originalSettings);

View File

@ -3197,13 +3197,11 @@ void update_free_window_state(WINDOW_STATE_ORDER* window_state)
rdpUpdate* update_new(rdpRdp* rdp)
{
const wObject cb = { NULL, NULL, NULL, update_free_queued_message, NULL };
rdp_update_internal* update;
rdp_altsec_update_internal* altsec;
rdp_primary_update_internal* primary;
rdp_secondary_update_internal* secondary;
OFFSCREEN_DELETE_LIST* deleteList;
WINPR_UNUSED(rdp);
update = (rdp_update_internal*)calloc(1, sizeof(rdp_update_internal));
WINPR_ASSERT(rdp);
WINPR_ASSERT(rdp->context);
rdp_update_internal* update = (rdp_update_internal*)calloc(1, sizeof(rdp_update_internal));
if (!update)
return NULL;
@ -3216,19 +3214,22 @@ rdpUpdate* update_new(rdpRdp* rdp)
if (!update->common.pointer)
goto fail;
primary = (rdp_primary_update_internal*)calloc(1, sizeof(rdp_primary_update_internal));
rdp_primary_update_internal* primary =
(rdp_primary_update_internal*)calloc(1, sizeof(rdp_primary_update_internal));
if (!primary)
goto fail;
update->common.primary = &primary->common;
secondary = (rdp_secondary_update_internal*)calloc(1, sizeof(rdp_secondary_update_internal));
rdp_secondary_update_internal* secondary =
(rdp_secondary_update_internal*)calloc(1, sizeof(rdp_secondary_update_internal));
if (!secondary)
goto fail;
update->common.secondary = &secondary->common;
altsec = (rdp_altsec_update_internal*)calloc(1, sizeof(rdp_altsec_update_internal));
rdp_altsec_update_internal* altsec =
(rdp_altsec_update_internal*)calloc(1, sizeof(rdp_altsec_update_internal));
if (!altsec)
goto fail;
@ -3239,7 +3240,7 @@ rdpUpdate* update_new(rdpRdp* rdp)
if (!update->common.window)
goto fail;
deleteList = &(altsec->create_offscreen_bitmap.deleteList);
OFFSCREEN_DELETE_LIST* deleteList = &(altsec->create_offscreen_bitmap.deleteList);
deleteList->sIndices = 64;
deleteList->indices = calloc(deleteList->sIndices, 2);