svn commit: r359183 - head/lib/libc/locale
Mark Johnston
markj at FreeBSD.org
Fri Mar 20 20:02:54 UTC 2020
Author: markj
Date: Fri Mar 20 20:02:53 2020
New Revision: 359183
URL: https://svnweb.freebsd.org/changeset/base/359183
Log:
Fix uselocale(3) to not leak a reference to the old locale.
In a single-threaded program pthread_getspecific() always returns NULL,
so the old locale would not end up being freed.
PR: 239520
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Modified:
head/lib/libc/locale/xlocale.c
Modified: head/lib/libc/locale/xlocale.c
==============================================================================
--- head/lib/libc/locale/xlocale.c Fri Mar 20 19:38:14 2020 (r359182)
+++ head/lib/libc/locale/xlocale.c Fri Mar 20 20:02:53 2020 (r359183)
@@ -163,7 +163,7 @@ set_thread_locale(locale_t loc)
if (NULL != l) {
xlocale_retain((struct xlocale_refcounted*)l);
}
- locale_t old = pthread_getspecific(locale_info_key);
+ locale_t old = get_thread_locale();
if ((NULL != old) && (l != old)) {
xlocale_release((struct xlocale_refcounted*)old);
}
More information about the svn-src-all
mailing list