Use g_string_free_and_steal() if glib is greater than 2.76.0