1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
From: Milan Crha <mcrha@redhat.com>
Date: Thu, 22 May 2025 10:32:30 +0200
Subject: websocket-test: Fix two memory leaks
The errors can be emitted also when joining the thread, in some cases,
thus disconnect the handlers to avoid memory leaks in such case.
Origin: upstream, 3.7.0, commit:a6df31d7a89298fcdc6da0373f16ca222d052061
---
tests/websocket-test.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/websocket-test.c b/tests/websocket-test.c
index 723f285..b980211 100644
--- a/tests/websocket-test.c
+++ b/tests/websocket-test.c
@@ -1602,6 +1602,9 @@ test_client_receive_masked_frame (Test *test,
g_clear_error (&error);
g_assert_null (received);
+ /* it can emit more errors while joining the thread, thus disconnect, to avoid memory leak */
+ g_signal_handlers_disconnect_by_func (test->client, G_CALLBACK (on_error_copy), &error);
+
g_thread_join (thread);
WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED);
@@ -2050,6 +2053,9 @@ test_deflate_receive_fragmented_error (Test *test,
g_clear_error (&error);
g_assert_null (received);
+ /* it can emit more errors while joining the thread, thus disconnect, to avoid memory leak */
+ g_signal_handlers_disconnect_by_func (test->client, G_CALLBACK (on_error_copy), &error);
+
g_thread_join (thread);
WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED);
|