server/proxy: Fix rdpgfx and events leak
authorkubistika <kmizrachi18@gmail.com>
Tue, 28 May 2019 13:10:04 +0000 (16:10 +0300)
committerakallabeth <akallabeth@users.noreply.github.com>
Wed, 26 Jun 2019 12:25:07 +0000 (14:25 +0200)
server/proxy/pf_context.c
server/proxy/pf_server.c

index 1169e77..05ee2d2 100644 (file)
@@ -44,8 +44,16 @@ static void client_to_proxy_context_free(freerdp_peer* client,
 {
        WINPR_UNUSED(client);
 
-       if (context)
-               WTSCloseServer((HANDLE) context->vcm);
+       if (!context)
+               return;
+
+       WTSCloseServer((HANDLE) context->vcm);
+
+       if (context->dynvcReady)
+       {
+               CloseHandle(context->dynvcReady);
+               context->dynvcReady = NULL;
+       }
 }
 
 BOOL init_p_server_context(freerdp_peer* client)
@@ -172,5 +180,11 @@ out_fail:
 void proxy_data_free(proxyData* pdata)
 {
        connection_info_free(pdata->info);
+       if (pdata->connectionClosed)
+       {
+               CloseHandle(pdata->connectionClosed);
+               pdata->connectionClosed = NULL;
+       }
+
        free(pdata);
 }
index bef3f1b..8cb9f3b 100644 (file)
@@ -366,12 +366,15 @@ fail:
                disp_server_context_free(ps->disp);
        }
 
+       if (ps->gfx)
+               rdpgfx_server_context_free(ps->gfx);
+               
        if (client->connected && !pf_common_connection_aborted_by_peer(pdata))
        {
                pf_server_handle_client_disconnection(client);
        }
 
-       pc = (rdpContext*)pdata->pc;
+       pc = (rdpContext*) pdata->pc;
        freerdp_client_stop(pc);
        proxy_data_free(pdata);
        freerdp_client_context_free(pc);