Fix memory leaks in libgio tests
Submitted by Stef Walter
Link to original bug (#711802)
Description
In order to make libgio tests be valgrindable, I'll post patches which fix memory leaks.
In general it's good practice to free stuff in tests, so that we can run through those code paths, and make sure we received appropriate references/memory.