Merge branch 'tests-memory-leaks' into 'master'

Fix minor memory leaks in tests

See merge request GNOME/glib!440
This commit is contained in:
Philip Withnall 2018-11-01 11:59:59 +00:00
commit bfc661a1db
3 changed files with 10 additions and 1 deletions

View File

@ -1040,6 +1040,8 @@ test_property_actions (void)
g_assert_cmpstr (name, ==, "keepalive"); g_assert_cmpstr (name, ==, "keepalive");
g_assert (enabled); g_assert (enabled);
g_free (name); g_free (name);
g_variant_type_free (ptype);
g_variant_type_free (stype);
g_variant_unref (state); g_variant_unref (state);
g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action)); g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action));

View File

@ -1160,6 +1160,8 @@ do_modify (gpointer data)
random_menu_change (menu, rand); random_menu_change (menu, rand);
} }
g_rand_free (rand);
return NULL; return NULL;
} }
@ -1201,9 +1203,11 @@ test_dbus_threaded (void)
for (i = 0; i < 10; i++) 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]); call[i] = g_thread_new ("call", do_modify, menu[i]);
export[i] = g_thread_new ("export", do_export, menu[i]); export[i] = g_thread_new ("export", do_export, menu[i]);
g_rand_free (rand);
} }
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)

View File

@ -205,10 +205,13 @@ main (int argc, char **argv)
g_option_context_add_main_entries (context, options, NULL); g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error)) if (!g_option_context_parse (context, &argc, &argv, &error))
{ {
g_option_context_free (context);
g_printerr ("%s: %s\n", argv[0], error->message); g_printerr ("%s: %s\n", argv[0], error->message);
return 1; return 1;
} }
g_option_context_free (context);
if (argc < 2) if (argc < 2)
{ {
g_printerr ("MODE argument required\n"); g_printerr ("MODE argument required\n");