From 891fcada5d01bcef941bd6a610014aad532baf13 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 7 Oct 2006 19:27:17 +0000 Subject: [PATCH] g_strdup the keys that we are passed before adding them to the hash MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2006-10-07 Tor Lillqvist * glib/gwin32.c (get_package_directory_from_module) (g_win32_get_package_installation_directory): g_strdup the keys that we are passed before adding them to the hash tables, to guard against the caller freeing them. (#355955, Andreas Köhler) --- ChangeLog | 7 +++++++ glib/gwin32.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 909dda4..0329a23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-10-07 Tor Lillqvist + + * glib/gwin32.c (get_package_directory_from_module) + (g_win32_get_package_installation_directory): g_strdup the keys + that we are passed before adding them to the hash tables, to guard + against the caller freeing them. (#355955, Andreas Köhler) + 2006-10-06 Matthias Clasen * glib/gtimer.c: Fix a typo. (#359190) diff --git a/glib/gwin32.c b/glib/gwin32.c index b4afdb4..f7a295e 100644 --- a/glib/gwin32.c +++ b/glib/gwin32.c @@ -1140,7 +1140,7 @@ get_package_directory_from_module (gchar *module_name) } #endif - g_hash_table_insert (module_dirs, module_name ? module_name : "", fn); + g_hash_table_insert (module_dirs, module_name ? g_strdup (module_name) : "", fn); G_UNLOCK (module_dirs); @@ -1243,7 +1243,7 @@ g_win32_get_package_installation_directory (gchar *package, if (result) { - g_hash_table_insert (package_dirs, package, result); + g_hash_table_insert (package_dirs, g_strdup (package), result); G_UNLOCK (package_dirs); return g_strdup (result); } -- 2.7.4