glib: Fix a memory leak when getting text layout and attributes