msvcrt: Fix C locale lc_time_curr refconting.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-11-25 20:24:09 +01:00 committed by Alexandre Julliard
parent e76c522ad9
commit 6e70b04c68
1 changed files with 4 additions and 4 deletions

View File

@ -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;