Plug small one-time leak on Windows. (#488068, Daniel Atallah)
authorTor Lillqvist <tml@novell.com>
Mon, 22 Oct 2007 20:13:55 +0000 (20:13 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Mon, 22 Oct 2007 20:13:55 +0000 (20:13 +0000)
2007-10-22  Tor Lillqvist  <tml@novell.com>

* glib/gutils.c (_glib_gettext): Plug small one-time leak on
Windows. (#488068, Daniel Atallah)

svn path=/trunk/; revision=5795

ChangeLog
glib/gutils.c

index d171296..eb4996f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-22  Tor Lillqvist  <tml@novell.com>
+
+       * glib/gutils.c (_glib_gettext): Plug small one-time leak on
+       Windows. (#488068, Daniel Atallah)
+
 2007-10-21  Behdad Esfahbod  <behdad@gnome.org>
 
        * glib/gdate.c (g_date_strftime):
index eb28e50..508f53a 100644 (file)
@@ -3143,7 +3143,7 @@ _g_utils_thread_init (void)
  * use system codepage as bindtextdomain() doesn't have a UTF-8
  * interface.
  */
-static const gchar *
+static gchar *
 _glib_get_locale_dir (void)
 {
   gchar *dir, *cp_dir;
@@ -3170,7 +3170,6 @@ _glib_get_locale_dir (void)
 }
 
 #undef GLIB_LOCALE_DIR
-#define GLIB_LOCALE_DIR _glib_get_locale_dir ()
 
 #endif /* G_OS_WIN32 */
 
@@ -3181,7 +3180,13 @@ _glib_gettext (const gchar *str)
 
   if (!_glib_gettext_initialized)
     {
+#ifdef G_OS_WIN32
+      gchar *tmp = _glib_get_locale_dir();
+      bindtextdomain(GETTEXT_PACKAGE, tmp);
+      g_free(tmp);
+#else
       bindtextdomain(GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
+#endif
 #    ifdef HAVE_BIND_TEXTDOMAIN_CODESET
       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 #    endif