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>
This commit is contained in:
Philip Withnall 2019-04-12 15:24:05 +01:00
parent 035c5d03f1
commit 2dac148299

View File

@ -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;
}