Implement cleanup in libgmodule
Submitted by Stef Walter
Link to original bug (#711767)
Description
Implement cleanup in libgmodule and associated tests.
I've split this out from bug #627423 for simplicity, since there are quite a few patches. That should make it easier to review, track dependencies and so on.
Goal here is to have all gmodule related tests running without leaks or memory issues.