This commit is contained in:
orbitcowboy 2022-07-29 21:41:32 +02:00
parent cfa5cd4849
commit 1934386738
2 changed files with 7 additions and 6 deletions

View File

@ -5369,8 +5369,7 @@ HFONT CreateFont(
<not-bool/>
</arg>
</function>
<!--void *_malloca(
size_t size);-->
<!--void *_malloca(size_t size);-->
<function name="_malloca">
<returnValue type="void *"/>
<use-retval/>
@ -5380,8 +5379,7 @@ HFONT CreateFont(
<valid>0:</valid>
</arg>
</function>
<!--void *_alloca(
size_t size);-->
<!--void *_alloca(size_t size);-->
<function name="_alloca">
<returnValue type="void *"/>
<noreturn>false</noreturn>
@ -5390,9 +5388,9 @@ HFONT CreateFont(
<not-uninit/>
<valid>0:</valid>
</arg>
<warn severity="style" alternatives="_malloca">This function is deprecated because a more secure version is available '_malloca'.</warn>
</function>
<!--void _freea(
void *memblock);-->
<!--void _freea(void *memblock);-->
<function name="_freea">
<noreturn>false</noreturn>
<returnValue type="void"/>

View File

@ -260,6 +260,7 @@ void validCode()
void *pMem1 = _malloca(1);
_freea(pMem1);
// Memory from _alloca must not be freed
// cppcheck-suppress _allocaCalled
void *pMem2 = _alloca(10);
memset(pMem2, 0, 10);
@ -683,6 +684,7 @@ void ignoredReturnValue()
// cppcheck-suppress leakReturnValNotUsed
_malloca(10);
// cppcheck-suppress ignoredReturnValue
// cppcheck-suppress _allocaCalled
_alloca(5);
// cppcheck-suppress ignoredReturnValue
@ -745,6 +747,7 @@ void invalidFunctionArg()
_freea(pMem);
// FIXME cppcheck-suppress unreadVariable
// cppcheck-suppress invalidFunctionArg
// cppcheck-suppress _allocaCalled
pMem = _alloca(-5);
}