You need this here: g_hash_table_foreach_steal(vmi->ss_events, event_entry_free, vmi);