• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From cabc49407371800733ada202fab721c9091b6fe6 Mon Sep 17 00:00:00 2001
2From: Pavel Sobolev <paveloom@riseup.net>
3Date: Thu, 14 Sep 2023 15:42:24 +0300
4Subject: [PATCH] Make sure the `GTask` is freed on a graceful disconnect
5
6This fixes the memory leak in the case the connection has been
7successfully closed by the peer.
8
9
10Conflict:NA
11Reference:https://gitlab.gnome.org/GNOME/glib/-/commit/cabc49407371800733ada202fab721c9091b6fe6
12
13---
14 gio/gtcpconnection.c | 3 ++-
15 1 file changed, 2 insertions(+), 1 deletion(-)
16
17diff --git a/gio/gtcpconnection.c b/gio/gtcpconnection.c
18index 422b3dea52..e0865d859b 100644
19--- a/gio/gtcpconnection.c
20+++ b/gio/gtcpconnection.c
21@@ -206,6 +206,8 @@ async_close_finish (GTask    *task,
22     g_task_return_error (task, error);
23   else
24     g_task_return_boolean (task, TRUE);
25+
26+  g_object_unref (task);
27 }
28
29
30@@ -231,7 +233,6 @@ close_read_ready (GSocket        *socket,
31       else
32 	{
33 	  async_close_finish (task, error);
34-	  g_object_unref (task);
35 	  return FALSE;
36 	}
37     }
38--
39GitLab