[gnome-remote-desktop] clipboard-rdp: Don't leak the MimeTypeTables



commit f27d2fa87979febb5de4e7d0de424c1ddca7dc78
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Sat Feb 27 12:57:16 2021 +0100

    clipboard-rdp: Don't leak the MimeTypeTables
    
    When the RDP client sends a new FormatList, but the session already
    stopped, then gnome-remote-desktop drops the FormatList.
    However, gnome-remote-desktop already prepared the MimeTypeTables for
    the update. These are currently leaked.
    
    So when the session already stopped, but gnome-remote-desktop still got
    a new FormatList, free the MimeTypeTables to prevent a memory leak.

 src/grd-clipboard-rdp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-clipboard-rdp.c b/src/grd-clipboard-rdp.c
index da5a301..68ac5a5 100644
--- a/src/grd-clipboard-rdp.c
+++ b/src/grd-clipboard-rdp.c
@@ -917,7 +917,10 @@ cliprdr_client_format_list (CliprdrServerContext      *cliprdr_context,
   WaitForMultipleObjects (2, events, FALSE, INFINITE);
 
   if (WaitForSingleObject (clipboard_rdp->stop_event, 0) == WAIT_OBJECT_0)
-    return CHANNEL_RC_OK;
+    {
+      g_list_free_full (mime_type_tables, g_free);
+      return CHANNEL_RC_OK;
+    }
 
   ResetEvent (clipboard_rdp->completed_format_list_event);
   update_context = g_malloc0 (sizeof (ServerFormatListUpdateContext));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]