Module: wine Branch: master Commit: 6e70b04c68183b4b08b7bbb60abacf9ca9fa3819 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6e70b04c68183b4b08b7bbb60...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Nov 25 20:24:09 2020 +0100
msvcrt: Fix C locale lc_time_curr refconting.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/locale.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 5971882229c..0c4211dc197 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -1099,8 +1099,8 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo) MSVCRT_free((void*)locinfo->pcumap); }
- if(locinfo->lc_time_curr && locinfo->lc_time_curr != &cloc_time_data - && !InterlockedDecrement(&locinfo->lc_time_curr->refcount)) + if(locinfo->lc_time_curr && !InterlockedDecrement(&locinfo->lc_time_curr->refcount) + && locinfo->lc_time_curr != &cloc_time_data) MSVCRT_free(locinfo->lc_time_curr);
if(InterlockedDecrement(&locinfo->refcount)) @@ -1932,8 +1932,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, lcid[MSVCRT_LC_TIME], cp[MSVCRT_LC_TIME])) { copy_threadlocinfo_category(locinfo, old_locinfo, MSVCRT_LC_TIME); locinfo->lc_time_curr = old_locinfo->lc_time_curr; - if(locinfo->lc_time_curr != &cloc_time_data) - InterlockedIncrement(&locinfo->lc_time_curr->refcount); + InterlockedIncrement(&locinfo->lc_time_curr->refcount); } else if(lcid[MSVCRT_LC_TIME]) { if(!update_threadlocinfo_category(lcid[MSVCRT_LC_TIME], cp[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME)) { @@ -1952,6 +1951,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category, return NULL; } locinfo->lc_time_curr = &cloc_time_data; + InterlockedIncrement(&locinfo->lc_time_curr->refcount); }
return locinfo;