From: Matthias Clasen Date: Mon, 18 Jun 2007 16:35:41 +0000 (+0000) Subject: Prevent segfaults on long paths. (#447935, Robby Griffin) X-Git-Tag: GLIB_2_13_5~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a6d2233e4502ff806e33de783ab29b68dcee167;p=platform%2Fupstream%2Fglib.git Prevent segfaults on long paths. (#447935, Robby Griffin) 2007-06-17 Matthias Clasen * glib/gutils (g_get_current_dir): Prevent segfaults on long paths. (#447935, Robby Griffin) svn path=/trunk/; revision=5574 --- diff --git a/ChangeLog b/ChangeLog index 4b3e1d2..d10b989 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 2e1a147..225e3a6 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 */