Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions cfg/windows.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,11 @@
<alloc init="true" arg="11">AllocateAndInitializeSid</alloc>
<dealloc>FreeSid</dealloc>
</memory>
<memory>
<alloc init="true">_create_locale</alloc>
<alloc init="true">_wcreate_locale</alloc>
<dealloc>_free_locale</dealloc>
</memory>
<!--SIZE_T RtlCompareMemory(
_In_ const VOID *Source1,
_In_ const VOID *Source2,
Expand Down Expand Up @@ -5591,6 +5596,38 @@ HFONT CreateFont(
<not-uninit/>
</arg>
</function>
<!--_locale_t _create_locale(int category, const char *locale);
_locale_t _wcreate_locale(int category, const wchar_t *locale);
void _free_locale(_locale_t locale);-->
<function name="_create_locale">
<returnValue type="_locale_t"/>
<noreturn>false</noreturn>
<use-retval/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
</function>
<function name="_wcreate_locale">
<returnValue type="_locale_t"/>
<noreturn>false</noreturn>
<use-retval/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
</function>
<function name="_free_locale">
<noreturn>false</noreturn>
<returnValue type="void"/>
<arg nr="1">
<not-uninit/>
</arg>
</function>
<!--char * strlwr(_Inout_z_ char * _Str);-->
<function name="strlwr">
<returnValue type="char *">arg1</returnValue>
Expand Down
22 changes: 22 additions & 0 deletions test/cfg/windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <wchar.h>
#include <atlstr.h>
#include <string>
#include <locale.h>

bool UpdateTraceACalled(TRACEHANDLE traceHandle, LPCSTR loggerName, EVENT_TRACE_PROPERTIES* pProperties)
{
Expand Down Expand Up @@ -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;
Expand Down
Loading