From 2bc1036f8050c5553484dd92f37a88b672875807 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 18 Feb 2022 02:34:25 +0000 Subject: [PATCH] tests: Fix a memory leak in the mainloop test The source needs to be removed from the `GMainContext` before being unreffed, otherwise the main context and main loop will be kept around. Signed-off-by: Philip Withnall --- glib/tests/mainloop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c index 25ef4f42e..8141010c8 100644 --- a/glib/tests/mainloop.c +++ b/glib/tests/mainloop.c @@ -1687,10 +1687,11 @@ threadf (gpointer data) source = g_timeout_source_new (250); g_source_set_callback (source, timeout_cb, loop, NULL); g_source_attach (source, context); - g_source_unref (source); g_main_loop_run (loop); + g_source_destroy (source); + g_source_unref (source); g_main_loop_unref (loop); return NULL;