glib2 test: fix resource leak