From 8f0bf5deae7463801c9da42e35e21f51a3077c50 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 30 Jun 2009 17:37:27 -0400 Subject: [PATCH] Fix double free and under-dup in ShellAppMonitor The hash table is keeping ownership of appid, we don't need to free it again. However we do need to re-dup it when we insert as a key. --- src/shell-app-monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shell-app-monitor.c b/src/shell-app-monitor.c index 6edf824dc..87b7f6c22 100644 --- a/src/shell-app-monitor.c +++ b/src/shell-app-monitor.c @@ -347,12 +347,12 @@ shell_app_monitor_on_window_removed (MetaWorkspace *workspace, if (window_count == 0) { g_hash_table_remove (self->running_appids, appid); - g_free (appid); g_signal_emit (self, signals[CHANGED], 0); } else { - g_hash_table_insert (self->running_appids, appid, GUINT_TO_POINTER (window_count)); + g_hash_table_insert (self->running_appids, g_strdup (appid), + GUINT_TO_POINTER (window_count)); } g_hash_table_remove (self->window_to_appid, window); }