CheckMemoryLeak: Minor updates
This commit is contained in:
parent
daf0563b07
commit
0679b89e84
|
@ -561,6 +561,7 @@ static TOKEN *getcode(const TOKEN *tok, const char varname[])
|
||||||
}
|
}
|
||||||
else if ( Match(tok, "if ( ! %var1% )", varnames) ||
|
else if ( Match(tok, "if ( ! %var1% )", varnames) ||
|
||||||
Match(tok, "if ( unlikely ( ! %var1% ) )", varnames) ||
|
Match(tok, "if ( unlikely ( ! %var1% ) )", varnames) ||
|
||||||
|
Match(tok, "if ( unlikely ( %var1% == NULL ) )", varnames) ||
|
||||||
Match(tok, "if ( %var1% == NULL )", varnames) ||
|
Match(tok, "if ( %var1% == NULL )", varnames) ||
|
||||||
Match(tok, "if ( NULL == %var1% )", varnames) ||
|
Match(tok, "if ( NULL == %var1% )", varnames) ||
|
||||||
Match(tok, "if ( %var1% == 0 )", varnames) )
|
Match(tok, "if ( %var1% == 0 )", varnames) )
|
||||||
|
@ -729,7 +730,12 @@ static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[]
|
||||||
|
|
||||||
if ( findmatch(tok, "alloc ; if continue ;") )
|
if ( findmatch(tok, "alloc ; if continue ;") )
|
||||||
{
|
{
|
||||||
MemoryLeak(gettok(findmatch(tok, "alloc ; if continue ;"), 4), varname);
|
MemoryLeak(gettok(findmatch(tok, "alloc ; if continue ;"), 3), varname);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ( findmatch(tok, "alloc ; if return ;") )
|
||||||
|
{
|
||||||
|
MemoryLeak(gettok(findmatch(tok, "alloc ; if return ;"), 3), varname);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( findmatch(tok, "alloc ; return ;") )
|
else if ( findmatch(tok, "alloc ; return ;") )
|
||||||
|
|
|
@ -561,7 +561,7 @@ static void memleak_in_function()
|
||||||
" }\n"
|
" }\n"
|
||||||
" free(str);\n"
|
" free(str);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
check( CheckMemoryLeak, __LINE__, code, "[test.cpp:6]: Memory leak: str\n" );
|
check_( CheckMemoryLeak, __LINE__, code, "[test.cpp:6]: Memory leak: str\n" );
|
||||||
|
|
||||||
|
|
||||||
code = "void f()\n"
|
code = "void f()\n"
|
||||||
|
|
Loading…
Reference in New Issue