[glib: 1/4] tests: Fix GRand leak in GMenuModel tests



commit 9347c7630f2e504685a0de4f5b1ebf82dba31505
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Thu Nov 1 00:00:00 2018 +0000

    tests: Fix GRand leak in GMenuModel tests

 gio/tests/gmenumodel.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gio/tests/gmenumodel.c b/gio/tests/gmenumodel.c
index 5d6f485c4..53e701360 100644
--- a/gio/tests/gmenumodel.c
+++ b/gio/tests/gmenumodel.c
@@ -1160,6 +1160,8 @@ do_modify (gpointer data)
       random_menu_change (menu, rand);
     }
 
+  g_rand_free (rand);
+
   return NULL;
 }
 
@@ -1201,9 +1203,11 @@ test_dbus_threaded (void)
 
   for (i = 0; i < 10; i++)
     {
-      menu[i] = random_menu_new (g_rand_new_with_seed (g_test_rand_int ()), 2);
+      GRand *rand = g_rand_new_with_seed (g_test_rand_int ());
+      menu[i] = random_menu_new (rand, 2);
       call[i] = g_thread_new ("call", do_modify, menu[i]);
       export[i] = g_thread_new ("export", do_export, menu[i]);
+      g_rand_free (rand);
     }
 
   for (i = 0; i < 10; i++)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]