From bce9811abab7840e2784bf943ba8a2ae5ea10d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Mon, 27 Jul 2026 14:07:08 +0200 Subject: [PATCH 1/2] add test --- test/cfg/windows.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp index c01e57f6f91..37c580a0134 100644 --- a/test/cfg/windows.cpp +++ b/test/cfg/windows.cpp @@ -23,6 +23,7 @@ #include #include #include +#include bool UpdateTraceACalled(TRACEHANDLE traceHandle, LPCSTR loggerName, EVENT_TRACE_PROPERTIES* pProperties) { @@ -615,6 +616,27 @@ void memleak_malloca() // cppcheck-suppress memleak } +void memleak_create_locale() +{ + // cppcheck-suppress-begin valueFlowBailoutIncompleteVar + _locale_t locale = _create_locale(LC_ALL, "C"); + _locale_t wlocale = _wcreate_locale(LC_ALL, L"C"); + (void) locale; + (void) wlocale; + // cppcheck-suppress-end valueFlowBailoutIncompleteVar + // cppcheck-suppress memleak +} + +void no_memleak_create_locale() +{ + // cppcheck-suppress-begin valueFlowBailoutIncompleteVar + _locale_t locale = _create_locale(LC_ALL, "C"); + _locale_t wlocale = _wcreate_locale(LC_ALL, L"C"); + _free_locale(locale); + _free_locale(wlocale); + // cppcheck-suppress-end valueFlowBailoutIncompleteVar +} + void memleak_AllocateAndInitializeSid() { PSID pEveryoneSID = NULL; From 4d2c57614d95bc96dbc471374374c591b0d71803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Mon, 27 Jul 2026 13:58:58 +0200 Subject: [PATCH 2/2] fix --- cfg/windows.cfg | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 6a0bd111afa..b2251900d42 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -1331,6 +1331,11 @@ AllocateAndInitializeSid FreeSid + + _create_locale + _wcreate_locale + _free_locale + + + + false + + + + + + + + + + + false + + + + + + + + + + false + + + + + arg1