Fix memory leaks in libgobject tests
Submitted by Stef Walter
Link to original bug (#711779)
Description
In order to make libgobject 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.