fix memory leaks in disp server and gfx.c

This commit is contained in:
Kobi Mizrachi 2019-12-31 15:47:03 +02:00 committed by akallabeth
parent 47ca28b5c3
commit 2d9a50fafb
2 changed files with 9 additions and 1 deletions

View File

@ -275,7 +275,7 @@ static UINT disp_server_handle_messages(DispServerContext* context)
WTSFreeMemory(buffer);
}
/* Consume channel event only after the gfx dynamic channel is ready */
/* Consume channel event only after the disp dynamic channel is ready */
Stream_SetPosition(s, 0);
if (!WTSVirtualChannelRead(priv->disp_channel, 0, NULL, 0, &BytesReturned))
@ -384,6 +384,7 @@ static UINT disp_server_open(DispServerContext* context)
}
priv->SessionId = (DWORD)*pSessionId;
WTSFreeMemory(pSessionId);
priv->disp_channel = (HANDLE)WTSVirtualChannelOpenEx(priv->SessionId, DISP_DVC_CHANNEL_NAME,
WTS_CHANNEL_OPTION_DYNAMIC);
@ -513,6 +514,12 @@ static UINT disp_server_close(DispServerContext* context)
priv->stopEvent = NULL;
}
if (priv->disp_channel)
{
WTSVirtualChannelClose(priv->disp_channel);
priv->disp_channel = NULL;
}
return error;
}

View File

@ -1214,6 +1214,7 @@ static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
cacheEntry->width, cacheEntry->height, surface->data, surface->format,
surface->scanline, rect->left, rect->top, NULL, FREERDP_FLIP_NONE))
{
free(cacheEntry->data);
free(cacheEntry);
goto fail;
}