freerdp: Fix possible crash when setting error info in server-mode

This commit is contained in:
Martin Fleisz 2016-03-14 15:27:15 +01:00
parent 05bcec47b8
commit b2d24a4dd2
2 changed files with 17 additions and 9 deletions

View File

@ -627,7 +627,11 @@ UINT32 freerdp_error_info(freerdp* instance)
return instance->context->rdp->errorInfo;
}
void freerdp_set_error_info(rdpRdp* rdp, UINT32 error) {
void freerdp_set_error_info(rdpRdp* rdp, UINT32 error)
{
if (!rdp)
return;
rdp_set_error_info(rdp, error);
}

View File

@ -248,15 +248,19 @@ BOOL rdp_set_error_info(rdpRdp* rdp, UINT32 errorInfo)
if (rdp->errorInfo != ERRINFO_SUCCESS)
{
ErrorInfoEventArgs e;
rdpContext* context = rdp->instance->context;
rdp->context->LastError = MAKE_FREERDP_ERROR(ERRINFO, errorInfo);
rdpContext* context = rdp->context;
rdp_print_errinfo(rdp->errorInfo);
EventArgsInit(&e, "freerdp");
e.code = rdp->errorInfo;
PubSub_OnErrorInfo(context->pubSub, context, &e);
if (context)
{
context->LastError = MAKE_FREERDP_ERROR(ERRINFO, errorInfo);
if (context->pubSub)
{
ErrorInfoEventArgs e;
EventArgsInit(&e, "freerdp");
e.code = rdp->errorInfo;
PubSub_OnErrorInfo(context->pubSub, context, &e);
}
}
}
else
{