tests: Fix some minor leaks in the unit tests

https://bugzilla.gnome.org/show_bug.cgi?id=737446
This commit is contained in:
Philip Withnall 2014-09-26 16:18:46 +01:00 committed by Philip Withnall
parent cb2c6eef0a
commit a4612a922b
3 changed files with 9 additions and 3 deletions

View File

@ -31,6 +31,7 @@ test_load_from_data_dirs (void)
g_assert (!res); g_assert (!res);
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT); g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
g_assert_null (path); g_assert_null (path);
g_error_free (error);
g_bookmark_file_free (bookmark); g_bookmark_file_free (bookmark);
} }

View File

@ -46,7 +46,7 @@
#define S G_DIR_SEPARATOR_S #define S G_DIR_SEPARATOR_S
static void static void
check_string (gchar *str, gchar *expected) check_string (gchar *str, const gchar *expected)
{ {
g_assert (str != NULL); g_assert (str != NULL);
g_assert_cmpstr (str, ==, expected); g_assert_cmpstr (str, ==, expected);
@ -825,6 +825,7 @@ test_read_link (void)
path = g_file_read_link (oldpath, &error); path = g_file_read_link (oldpath, &error);
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL); g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL);
g_assert_null (path); g_assert_null (path);
g_error_free (error);
g_free (cwd); g_free (cwd);
g_free (newpath); g_free (newpath);

View File

@ -2384,12 +2384,13 @@ short_remaining (void)
{ NULL } { NULL }
}; };
GOptionContext* context; GOptionContext* context;
gchar **argv; gchar **argv, **argv_copy;
gint argc; gint argc;
g_test_bug ("729563"); g_test_bug ("729563");
argv = split_string ("program -ri -n 4 -t hello file1 file2", &argc); argv = split_string ("program -ri -n 4 -t hello file1 file2", &argc);
argv_copy = copy_stringv (argv, argc);
context = g_option_context_new (NULL); context = g_option_context_new (NULL);
@ -2407,7 +2408,10 @@ short_remaining (void)
g_assert_cmpstr (files[1], ==, "file2"); g_assert_cmpstr (files[1], ==, "file2");
g_assert (files[2] == NULL); g_assert (files[2] == NULL);
g_strfreev (argv); g_free (text);
g_strfreev (files);
g_strfreev (argv_copy);
g_free (argv);
g_option_context_free (context); g_option_context_free (context);
} }