From fd32dd86237268f9da7762e0e229be4a7a0d142d Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 7 Jun 2017 14:10:43 +0000 Subject: [PATCH] [INTL] Fix freeing logic in GetSupportedCP(). Patch by Victor Martinez Calvo. CORE-13385 svn path=/trunk/; revision=74941 --- reactos/dll/cpl/intl/advanced.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/reactos/dll/cpl/intl/advanced.c b/reactos/dll/cpl/intl/advanced.c index 6f74b2a82e7..3c9f51101fe 100644 --- a/reactos/dll/cpl/intl/advanced.c +++ b/reactos/dll/cpl/intl/advanced.c @@ -61,19 +61,20 @@ GetSupportedCP( { pCodePage->NextItem = PCPage; PCPage = pCodePage; + + wsprintf(szSection, L"CODEPAGE_REMOVE_%d", uiCodePage); + + if ((uiCodePage == GetACP()) || + (uiCodePage == GetOEMCP()) || + (!SetupFindFirstLineW(hInf, szSection, L"AddReg", &Context2))) + { + pCodePage->Flags |= CODEPAGE_NOT_REMOVEABLE; + } } else { HeapFree(GetProcessHeap(), 0, pCodePage); } - - wsprintf(szSection, L"CODEPAGE_REMOVE_%d", uiCodePage); - if ((uiCodePage == GetACP()) || - (uiCodePage == GetOEMCP()) || - (!SetupFindFirstLineW(hInf, szSection, L"AddReg", &Context2))) - { - pCodePage->Flags |= CODEPAGE_NOT_REMOVEABLE; - } } if (!SetupFindNextLine(&Context, &Context))