[glib] tests: Fix some minor leaks in the unit tests
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] tests: Fix some minor leaks in the unit tests
- Date: Sat, 27 Sep 2014 09:30:54 +0000 (UTC)
commit a4612a922bc984ff45e2096d2d286da1be5be481
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Sep 26 16:18:46 2014 +0100
tests: Fix some minor leaks in the unit tests
https://bugzilla.gnome.org/show_bug.cgi?id=737446
glib/tests/bookmarkfile.c | 1 +
glib/tests/fileutils.c | 3 ++-
glib/tests/option-context.c | 8 ++++++--
3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/glib/tests/bookmarkfile.c b/glib/tests/bookmarkfile.c
index 00605ed..7c2f8d7 100644
--- a/glib/tests/bookmarkfile.c
+++ b/glib/tests/bookmarkfile.c
@@ -31,6 +31,7 @@ test_load_from_data_dirs (void)
g_assert (!res);
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
g_assert_null (path);
+ g_error_free (error);
g_bookmark_file_free (bookmark);
}
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
index 1f66392..fff4217 100644
--- a/glib/tests/fileutils.c
+++ b/glib/tests/fileutils.c
@@ -46,7 +46,7 @@
#define S G_DIR_SEPARATOR_S
static void
-check_string (gchar *str, gchar *expected)
+check_string (gchar *str, const gchar *expected)
{
g_assert (str != NULL);
g_assert_cmpstr (str, ==, expected);
@@ -825,6 +825,7 @@ test_read_link (void)
path = g_file_read_link (oldpath, &error);
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL);
g_assert_null (path);
+ g_error_free (error);
g_free (cwd);
g_free (newpath);
diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c
index d56eb53..8cf77a6 100644
--- a/glib/tests/option-context.c
+++ b/glib/tests/option-context.c
@@ -2384,12 +2384,13 @@ short_remaining (void)
{ NULL }
};
GOptionContext* context;
- gchar **argv;
+ gchar **argv, **argv_copy;
gint argc;
g_test_bug ("729563");
argv = split_string ("program -ri -n 4 -t hello file1 file2", &argc);
+ argv_copy = copy_stringv (argv, argc);
context = g_option_context_new (NULL);
@@ -2407,7 +2408,10 @@ short_remaining (void)
g_assert_cmpstr (files[1], ==, "file2");
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]