[glib/glib-2-24] Plug memory leak on Windows



commit f06f37e2b09763593ba840f7f99f427a42feefa4
Author: Tor Lillqvist <tml iki fi>
Date:   Thu Jun 10 11:52:25 2010 +0300

    Plug memory leak on Windows
    
    Intern the string returned from g_win32_getlocale() and then free it.
    Fixes bug #621168.

 glib/gutils.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/glib/gutils.c b/glib/gutils.c
index 744663e..8698746 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -3086,9 +3086,12 @@ guess_category_value (const gchar *category_name)
    * by Windows and the Microsoft C runtime (in the "English_United
    * States" format) translated into the Unixish format.
    */
-  retval = g_win32_getlocale ();
-  if ((retval != NULL) && (retval[0] != '\0'))
+  {
+    char *locale = g_win32_getlocale ();
+    retval = g_intern_string (locale);
+    g_free (locale);
     return retval;
+  }
 #endif  
 
   return NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]