GOptionContext test: free all arguments, not just the remaining ones
commit5dca72fe67aec5f98bfb68257c34ff133b59d22a
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 12 Dec 2011 18:56:21 +0000 (12 18:56 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 14 Dec 2011 12:40:39 +0000 (14 12:40 +0000)
treedb6db30d0386020258d83794bcf002eceb5bbce0
parent29f2ced8eb32d9001da8082c4530f017decb8267
GOptionContext test: free all arguments, not just the remaining ones

On success, g_option_context_parse alters argv by removing options that
it understood, so g_strfreev is insufficient. Instead, take a shallow
copy and free all of the arguments in that, then free the array argv
but not its contents.

Also, improve the checks in error cases, by checking that argv has
not been altered in this way.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666115
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
glib/tests/option-context.c