[glib] tests: fix leaks in option-context test
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] tests: fix leaks in option-context test
- Date: Sat, 11 Jan 2014 05:47:14 +0000 (UTC)
commit d751e65aff6df64318ab2d95b3098dd155a1e0aa
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Jan 10 12:28:14 2014 -0500
tests: fix leaks in option-context test
Use the new g_option_context_parse_strv() to patch up some leaks in some
insufficiently-argv-emulating testcases in option-context.c.
This gives some test coverage of the new function while also making
option-context now leak-free.
https://bugzilla.gnome.org/show_bug.cgi?id=721947
glib/tests/option-context.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c
index 0d6aae3..b03add3 100644
--- a/glib/tests/option-context.c
+++ b/glib/tests/option-context.c
@@ -2325,11 +2325,12 @@ flag_reverse_string (void)
argv = split_string ("program --test bla", &argc);
- retval = g_option_context_parse (context, &argc, &argv, &error);
+ retval = g_option_context_parse_strv (context, &argv, &error);
g_assert (retval == TRUE);
g_assert_no_error (error);
g_strfreev (argv);
g_option_context_free (context);
+ g_free (arg);
}
static void
@@ -2357,7 +2358,7 @@ flag_optional_int (void)
argv = split_string ("program --test 5", &argc);
- retval = g_option_context_parse (context, &argc, &argv, &error);
+ retval = g_option_context_parse_strv (context, &argv, &error);
g_assert (retval == TRUE);
g_assert_no_error (error);
g_strfreev (argv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]