From a4b9b41afc0a4fdaea4f146bb5cc0301b8b72e73 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 18 Jan 2024 16:54:01 +0000 Subject: [PATCH] tests: Fix a double-free in param test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This isn’t normally hit because it’s in a test which is disabled unless run with `-m thorough`. The data is owned by `g_test_add_data_func_full()` until the end of the process. Signed-off-by: Philip Withnall --- gobject/tests/param.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gobject/tests/param.c b/gobject/tests/param.c index 9680aa42c..160eff4c3 100644 --- a/gobject/tests/param.c +++ b/gobject/tests/param.c @@ -1670,8 +1670,7 @@ main (int argc, char *argv[]) data.change_this_flag, data.change_this_type, data.use_this_flag, data.use_this_type); test_data = g_memdup2 (&data, sizeof (TestParamImplementData)); - g_test_add_data_func_full (test_path, test_data, test_param_implement_child, g_free); - g_free (test_data); + g_test_add_data_func_full (test_path, g_steal_pointer (&test_data), test_param_implement_child, g_free); g_free (test_path); }