* [bug #34023] Memory leak in i18n.c
@ 2011-08-16 10:36 Stefan Israelsson Tampe
2011-08-16 11:23 ` Andy Wingo
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Israelsson Tampe @ 2011-08-16 10:36 UTC (permalink / raw)
To: Stefan Israelsson Tampe, bug-guile
URL:
<http://savannah.gnu.org/bugs/?34023>
Summary: Memory leak in i18n.c
Project: Guile
Submitted by: tampe
Submitted on: Tue 16 Aug 2011 10:36:51 AM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
This looks strange:
Consider this in i18.c,
get_current_locale (SCM *result)
{
int err = 0;
scm_t_locale c_locale;
const char *current_locale;
(1) c_locale = scm_gc_malloc (sizeof (* c_locale), "locale");
lock_locale_mutex ();
c_locale->category_mask = LC_ALL_MASK;
c_locale->base_locale = SCM_UNDEFINED;
current_locale = setlocale (LC_ALL, NULL);
if (current_locale != NULL)
{
(2) c_locale->locale_name = strdup (current_locale);
if (c_locale->locale_name == NULL)
err = ENOMEM;
}
else
err = EINVAL;
unlock_locale_mutex ();
if (err)
scm_gc_free (c_locale, sizeof (* c_locale), "locale");
else
SCM_NEWSMOB (*result, scm_tc16_locale_smob_type, c_locale);
return err;
}
(1) c_locale is allocated managed by gc and not pointerless.
e.g. members should as well be gc allocated
(2) a memeber of c_locale is setted to a malloced memory region
should it be scm_strdup?
/Stefan
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?34023>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-16 11:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16 10:36 [bug #34023] Memory leak in i18n.c Stefan Israelsson Tampe
2011-08-16 11:23 ` Andy Wingo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).