diff --git a/ChangeLog b/ChangeLog index 4b3e1d2e0..d10b9894c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-17 Matthias Clasen + + * glib/gutils (g_get_current_dir): Prevent segfaults on + long paths. (#447935, Robby Griffin) + 2007-06-17 Behdad Esfahbod * glib/gdataset.c (g_quark_from_string), @@ -16,7 +21,7 @@ called. (#447583) * glib/gthread.c (g_static_mutex_free): Clarified comment to - remind myself, tha calling g_static_mutex_free() before + remind myself, that calling g_static_mutex_free() before g_thread_init() is safe. 2007-06-15 Cody Russell diff --git a/glib/gutils.c b/glib/gutils.c index 2e1a1470e..225e3a6fa 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -964,6 +964,7 @@ g_get_current_dir (void) #else /* !sun || !HAVE_GETCWD */ while (max_len < G_MAXULONG / 2) { + g_free (buffer); buffer = g_new (gchar, max_len + 1); *buffer = 0; dir = getcwd (buffer, max_len); @@ -971,7 +972,6 @@ g_get_current_dir (void) if (dir || errno != ERANGE) break; - g_free (buffer); max_len *= 2; } #endif /* !sun || !HAVE_GETCWD */