Merge pull request #3225 from mfleisz/fix_set_err_info

freerdp: Fix possible crash when setting error info in server-mode
This commit is contained in:
akallabeth 2016-03-15 09:25:50 +01:00
commit b35f3062f3
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
{