guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-41-g42f958


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-41-g42f9581
Date: Tue, 16 Aug 2011 11:20:38 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=42f9581238b011d15114bfd31606cbda10574d17

The branch, stable-2.0 has been updated
       via  42f9581238b011d15114bfd31606cbda10574d17 (commit)
      from  e7a81c7acdc0501b3fca6cdd51eb05d4fe39d317 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 42f9581238b011d15114bfd31606cbda10574d17
Author: Andy Wingo <address@hidden>
Date:   Tue Aug 16 13:16:21 2011 +0200

    fix leak in get_current_locale()
    
    * libguile/i18n.c (get_current_locale): Hold the locale name in a
      GC-managed string, not a mallocated string.  Thanks to Stefan
      Israelsson Tampe for the report.

-----------------------------------------------------------------------

Summary of changes:
 libguile/i18n.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/libguile/i18n.c b/libguile/i18n.c
index f9ec723..82e8b2a 100644
--- a/libguile/i18n.c
+++ b/libguile/i18n.c
@@ -501,7 +501,6 @@ get_current_locale (SCM *result)
 
   c_locale = scm_gc_malloc (sizeof (* c_locale), "locale");
 
-
   lock_locale_mutex ();
 
   c_locale->category_mask = LC_ALL_MASK;
@@ -509,20 +508,16 @@ get_current_locale (SCM *result)
 
   current_locale = setlocale (LC_ALL, NULL);
   if (current_locale != NULL)
-    {
-      c_locale->locale_name = strdup (current_locale);
-      if (c_locale->locale_name == NULL)
-       err = ENOMEM;
-    }
+    c_locale->locale_name = scm_gc_strdup (current_locale);
   else
     err = EINVAL;
 
   unlock_locale_mutex ();
 
-  if (err)
-    scm_gc_free (c_locale, sizeof (* c_locale), "locale");
-  else
+  if (err == 0)
     SCM_NEWSMOB (*result, scm_tc16_locale_smob_type, c_locale);
+  else
+    *result = SCM_BOOL_F;
 
   return err;
 }


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]