testsuite: Assorted leak fixes

All found by asan.
This commit is contained in:
Matthias Clasen 2020-07-08 17:43:14 -04:00
parent 26a23d3e56
commit 0dc946da63
5 changed files with 12 additions and 2 deletions

View File

@ -5971,6 +5971,7 @@ specific_bug_346800 (void)
columns[1] = G_TYPE_BOOLEAN;
store = gtk_tree_store_newv (2, columns);
model = GTK_TREE_MODEL (store);
GList *junk = NULL;
/*http://bugzilla.gnome.org/show_bug.cgi?id=346800 */
@ -5981,14 +5982,14 @@ specific_bug_346800 (void)
{
/* allocate random amounts of junk, otherwise the filter model's arrays can expand without moving */
g_malloc (138);
junk = g_list_append (junk, g_malloc (138));
gtk_tree_store_append (store, &node_iters[i], NULL);
gtk_tree_store_set (store, &node_iters[i],
0, "something",
1, ((i%6) == 0) ? FALSE : TRUE,
-1);
g_malloc (47);
junk = g_list_append (junk, g_malloc (47));
gtk_tree_store_append (store, &child_iters[i], &node_iters[i]);
gtk_tree_store_set (store, &child_iters[i],
0, "something else",
@ -6007,6 +6008,8 @@ specific_bug_346800 (void)
gtk_tree_model_filter_refilter (filter);
}
}
g_list_free_full (junk, g_free);
}
static gboolean

View File

@ -354,6 +354,8 @@ test_trigger_trigger (void)
}
gdk_event_unref (event);
g_free (keys);
}
gdk_surface_destroy (surface);

View File

@ -304,6 +304,7 @@ main (int argc, char **argv)
g_error ("Option parsing failed: %s\n", error->message);
return 1;
}
g_option_context_free (context);
gtk_init ();

View File

@ -1360,6 +1360,7 @@ check_buffer_contents (GtkTextBuffer *buffer,
gtk_text_buffer_get_end_iter (buffer, &end);
buffer_contents = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
g_assert_cmpstr (buffer_contents, ==, contents);
g_free (buffer_contents);
}
static void

View File

@ -78,6 +78,7 @@ parse_command_line (int *argc, char ***argv)
g_print ("option parsing failed: %s\n", error->message);
return FALSE;
}
g_option_context_free (context);
for (i = 0; i < *argc; i++)
{
@ -325,6 +326,8 @@ test_ui_file (GFile *file)
}
remove_extra_css (provider);
g_free (ui_file);
}
static int