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
This commit is contained in:
parent
c09f243a5c
commit
733983be9b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359183
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user