Memory leak : Fixed false positive for "list += data"

This commit is contained in:
Daniel Marjamäki 2008-12-28 20:57:50 +00:00
parent ec32e071b5
commit 7f1b98d7ae
2 changed files with 10 additions and 1 deletions

View File

@ -578,7 +578,8 @@ TOKEN *CheckMemoryLeakClass::getcode(const TOKEN *tok, std::list<const TOKEN *>
// Assignment..
if ( TOKEN::Match(tok,"[)=] %var1% [+;)]", varnames) ||
TOKEN::Match(tok, "%var1% +=|-=", varnames) )
TOKEN::Match(tok, "%var1% +=|-=", varnames) ||
TOKEN::Match(tok, "+= %var1% ;", varnames) )
addtoken("use");
// Investigate function calls..

View File

@ -1288,6 +1288,14 @@ private:
"}\n" );
ASSERT_EQUALS( std::string(""), errout.str() );
check( "void foo()\n"
"{\n"
" char *a = new char[100];\n"
" list += a;\n"
"}\n" );
ASSERT_EQUALS( std::string(""), errout.str() );
}