public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug locale/25770] New: newlocale memory leak in LOCPATH parsing
@ 2020-04-03 8:51 fweimer at redhat dot com
2020-04-03 9:50 ` [Bug locale/25770] newlocale memory leak in LOCPATH parsing and on error paths fweimer at redhat dot com
0 siblings, 1 reply; 2+ messages in thread
From: fweimer at redhat dot com @ 2020-04-03 8:51 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=25770
Bug ID: 25770
Summary: newlocale memory leak in LOCPATH parsing
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: locale
Assignee: unassigned at sourceware dot org
Reporter: fweimer at redhat dot com
Target Milestone: ---
Originally reported here:
https://github.com/valhalla/valhalla/pull/2296#issuecomment-608304654
Reproducer:
#include <locale.h>
int main() {
freelocale(newlocale(LC_ALL, "sv_SE.UTF-8", 0));
return 0;
}
The allocation created by __argz_add_sep in locale/newlocale.c is never freed:
/* We perhaps really have to load some data. So we determine the
path in which to look for the data now. The environment variable
`LOCPATH' must only be used when the binary has no SUID or SGID
bit set. If using the default path, we tell _nl_find_locale
by passing null and it can check the canonical locale archive. */
locale_path = NULL;
locale_path_len = 0;
locpath_var = getenv ("LOCPATH");
if (locpath_var != NULL && locpath_var[0] != '\0')
{
if (__argz_create_sep (locpath_var, ':',
&locale_path, &locale_path_len) != 0)
return NULL;
if (__argz_add_sep (&locale_path, &locale_path_len,
_nl_default_locale_path, ':') != 0)
return NULL;
}
It's not a global variable, either, so it's an unbounded leak.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug locale/25770] newlocale memory leak in LOCPATH parsing and on error paths
2020-04-03 8:51 [Bug locale/25770] New: newlocale memory leak in LOCPATH parsing fweimer at redhat dot com
@ 2020-04-03 9:50 ` fweimer at redhat dot com
0 siblings, 0 replies; 2+ messages in thread
From: fweimer at redhat dot com @ 2020-04-03 9:50 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=25770
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|newlocale memory leak in |newlocale memory leak in
|LOCPATH parsing |LOCPATH parsing and on
| |error paths
--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
There are other memory leaks because the ERROR_RETURN macro does not free
allocations.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-03 9:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 8:51 [Bug locale/25770] New: newlocale memory leak in LOCPATH parsing fweimer at redhat dot com
2020-04-03 9:50 ` [Bug locale/25770] newlocale memory leak in LOCPATH parsing and on error paths fweimer at redhat dot com
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).