mirror of https://github.com/FreeRDP/FreeRDP
Merge pull request #2890 from realjiangms/shadow_fix_memory_leak
server: Fix several memory leak found while running valgrind on freerdp-shadow
This commit is contained in:
commit
affe82cae8
|
@ -782,6 +782,8 @@ void rdpsnd_server_context_free(RdpsndServerContext* context)
|
|||
|
||||
free(context->client_formats);
|
||||
|
||||
free(context->priv);
|
||||
|
||||
free(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -983,7 +983,6 @@ HANDLE WINAPI FreeRDP_WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPS
|
|||
goto error_receiveData;
|
||||
}
|
||||
channel->queue = MessageQueue_New(NULL);
|
||||
channel->queue = MessageQueue_New(NULL);
|
||||
if (!channel->queue)
|
||||
goto error_queue;
|
||||
|
||||
|
|
|
@ -710,8 +710,15 @@ rdtkFont* rdtk_embedded_font_new(rdtkEngine* engine, BYTE* imageData, int imageS
|
|||
|
||||
void rdtk_font_free(rdtkFont* font)
|
||||
{
|
||||
if (font)
|
||||
{
|
||||
free(font->family);
|
||||
free(font->style);
|
||||
winpr_image_free(font->image, TRUE);
|
||||
free(font->glyphs);
|
||||
free(font);
|
||||
}
|
||||
}
|
||||
|
||||
int rdtk_font_engine_init(rdtkEngine* engine)
|
||||
{
|
||||
|
|
|
@ -625,6 +625,7 @@ int shadow_server_init(rdpShadowServer* server)
|
|||
if (status >= 0)
|
||||
return status;
|
||||
|
||||
shadow_subsystem_free(server->subsystem);
|
||||
fail_subsystem_new:
|
||||
freerdp_listener_free(server->listener);
|
||||
server->listener = NULL;
|
||||
|
@ -651,33 +652,33 @@ fail_client_array:
|
|||
|
||||
int shadow_server_uninit(rdpShadowServer* server)
|
||||
{
|
||||
if (!server)
|
||||
return -1;
|
||||
|
||||
shadow_server_stop(server);
|
||||
|
||||
if (server->listener)
|
||||
{
|
||||
shadow_subsystem_uninit(server->subsystem);
|
||||
|
||||
shadow_subsystem_free(server->subsystem);
|
||||
|
||||
freerdp_listener_free(server->listener);
|
||||
server->listener = NULL;
|
||||
}
|
||||
|
||||
if (server->CertificateFile)
|
||||
{
|
||||
free(server->CertificateFile);
|
||||
server->CertificateFile = NULL;
|
||||
}
|
||||
|
||||
if (server->PrivateKeyFile)
|
||||
{
|
||||
free(server->PrivateKeyFile);
|
||||
server->PrivateKeyFile = NULL;
|
||||
}
|
||||
|
||||
if (server->ipcSocket)
|
||||
{
|
||||
free(server->ipcSocket);
|
||||
server->ipcSocket = NULL;
|
||||
}
|
||||
free(server->ConfigPath);
|
||||
server->ConfigPath = NULL;
|
||||
|
||||
shadow_subsystem_uninit(server->subsystem);
|
||||
DeleteCriticalSection(&(server->lock));
|
||||
|
||||
CloseHandle(server->StopEvent);
|
||||
server->StopEvent = NULL;
|
||||
|
||||
ArrayList_Free(server->clients);
|
||||
server->clients = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -705,15 +706,8 @@ void shadow_server_free(rdpShadowServer* server)
|
|||
if (!server)
|
||||
return;
|
||||
|
||||
DeleteCriticalSection(&(server->lock));
|
||||
|
||||
if (server->clients)
|
||||
{
|
||||
ArrayList_Free(server->clients);
|
||||
server->clients = NULL;
|
||||
}
|
||||
|
||||
shadow_subsystem_free(server->subsystem);
|
||||
free(server->ipcSocket);
|
||||
server->ipcSocket = NULL;
|
||||
|
||||
free(server);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue