Module: wine Branch: master Commit: 84559266626938582b065cbb52e1b2a221116f02 URL: https://source.winehq.org/git/wine.git/?a=commit;h=84559266626938582b065cbb5...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Nov 18 17:25:47 2020 +0100
msvcrt: locinfo->lc_name should be guarded by lc_category->wrefcount.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/locale.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index ca50fc7e390..a305f88e808 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -407,6 +407,11 @@ static inline BOOL set_lc_locale_name(MSVCRT_pthreadlocinfo locinfo, int cat) WCHAR buf[100]; int len;
+ locinfo->lc_category[cat].wrefcount = MSVCRT_malloc(sizeof(int)); + if(!locinfo->lc_category[cat].wrefcount) + return FALSE; + *locinfo->lc_category[cat].wrefcount = 1; + len = GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME |LOCALE_NOUSEROVERRIDE, buf, 100); if(!len) return FALSE; @@ -931,6 +936,7 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo) for(i=MSVCRT_LC_MIN+1; i<=MSVCRT_LC_MAX; i++) { MSVCRT_free(locinfo->lc_category[i].locale); MSVCRT_free(locinfo->lc_category[i].refcount); + MSVCRT_free(locinfo->lc_category[i].wrefcount); #if _MSVCR_VER >= 110 MSVCRT_free(locinfo->lc_name[i]); #endif