[glib: 4/8] gthreadedsocketservice: Handle thread pool push failure



commit 2dac14829936cae27ac3a9046b6fee058ebda7ba
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Apr 12 15:24:05 2019 +0100

    gthreadedsocketservice: Handle thread pool push failure
    
    This was previously silently ignored, and would result in a leak.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 gio/gthreadedsocketservice.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gio/gthreadedsocketservice.c b/gio/gthreadedsocketservice.c
index 50ea4dd04..b330196e3 100644
--- a/gio/gthreadedsocketservice.c
+++ b/gio/gthreadedsocketservice.c
@@ -110,6 +110,7 @@ g_threaded_socket_service_incoming (GSocketService    *service,
 {
   GThreadedSocketService *threaded;
   GThreadedSocketServiceData *data;
+  GError *local_error = NULL;
 
   threaded = G_THREADED_SOCKET_SERVICE (service);
 
@@ -123,9 +124,13 @@ g_threaded_socket_service_incoming (GSocketService    *service,
     g_socket_service_stop (service);
   G_UNLOCK (job_count);
 
-  g_thread_pool_push (threaded->priv->thread_pool, data, NULL);
-
+  if (!g_thread_pool_push (threaded->priv->thread_pool, data, &local_error))
+    {
+      g_warning ("Error handling incoming socket: %s", local_error->message);
+      g_threaded_socket_service_data_free (data);
+    }
 
+  g_clear_error (&local_error);
 
   return FALSE;
 }


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