Memory leak: Better handling of 'if (0 != p)'
This commit is contained in:
parent
2dd4dba90e
commit
7e8b3c86f6
|
@ -357,7 +357,8 @@ TOKEN *CheckMemoryLeakClass::getcode(const TOKEN *tok, std::list<const TOKEN *>
|
||||||
|
|
||||||
// if else switch
|
// if else switch
|
||||||
if ( Match(tok, "if ( %var1% )", varnames) ||
|
if ( Match(tok, "if ( %var1% )", varnames) ||
|
||||||
Match(tok, "if ( %var1% != 0 )", varnames) )
|
Match(tok, "if ( %var1% != 0 )", varnames) ||
|
||||||
|
Match(tok, "if ( 0 != %var1% )", varnames) )
|
||||||
{
|
{
|
||||||
addtoken("if(var)");
|
addtoken("if(var)");
|
||||||
tok = Tokenizer::gettok(tok, 3); // Make sure the "use" will not be added
|
tok = Tokenizer::gettok(tok, 3); // Make sure the "use" will not be added
|
||||||
|
|
|
@ -417,7 +417,7 @@ private:
|
||||||
check( "void f()\n"
|
check( "void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" char *s = new char[100];\n"
|
" char *s = new char[100];\n"
|
||||||
" if (s != NULL)\n"
|
" if (0 != s)\n"
|
||||||
" foo(s);\n"
|
" foo(s);\n"
|
||||||
"}\n" );
|
"}\n" );
|
||||||
ASSERT_EQUALS( std::string(""), errout.str() );
|
ASSERT_EQUALS( std::string(""), errout.str() );
|
||||||
|
|
Loading…
Reference in New Issue