Skip to content

Commit 6252c53

Browse files
author
Paul Gofman
committed
msvcrt: Reference old locinfo for create_locinfo().
CW-Bug-Id: #23214
1 parent a9ece6e commit 6252c53

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dlls/msvcrt/locale.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,6 +2036,7 @@ char* CDECL setlocale(int category, const char* locale)
20362036
{
20372037
thread_data_t *data = msvcrt_get_thread_data();
20382038
pthreadlocinfo locinfo = get_locinfo(), newlocinfo;
2039+
BOOL need_free;
20392040

20402041
if(category<LC_MIN || category>LC_MAX)
20412042
return NULL;
@@ -2047,7 +2048,12 @@ char* CDECL setlocale(int category, const char* locale)
20472048
return locinfo->lc_category[category].locale;
20482049
}
20492050

2051+
if ((need_free = (locinfo && data->locale_flags & LOCALE_FREE)))
2052+
grab_locinfo(locinfo);
20502053
newlocinfo = create_locinfo(category, locale, locinfo);
2054+
if (need_free)
2055+
free_locinfo(locinfo);
2056+
20512057
if(!newlocinfo) {
20522058
WARN("%d %s failed\n", category, locale);
20532059
return NULL;

0 commit comments

Comments
 (0)