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>
This commit is contained in:
Simon McVittie 2011-12-12 18:56:21 +00:00
parent 29f2ced8eb
commit 5dca72fe67

File diff suppressed because it is too large Load Diff