CheckMemoryLeak: Minor updates

This commit is contained in:
Daniel Marjamäki 2008-08-17 18:01:37 +00:00
parent daf0563b07
commit 0679b89e84
2 changed files with 8 additions and 2 deletions

View File

@ -561,6 +561,7 @@ static TOKEN *getcode(const TOKEN *tok, const char varname[])
}
else if ( Match(tok, "if ( ! %var1% )", varnames) ||
Match(tok, "if ( unlikely ( ! %var1% ) )", varnames) ||
Match(tok, "if ( unlikely ( %var1% == NULL ) )", varnames) ||
Match(tok, "if ( %var1% == NULL )", varnames) ||
Match(tok, "if ( NULL == %var1% )", 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 ;") )
{
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 ;") )

View File

@ -561,7 +561,7 @@ static void memleak_in_function()
" }\n"
" free(str);\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"