Memory leak : Fixed false positive for "list += data"
This commit is contained in:
parent
ec32e071b5
commit
7f1b98d7ae
|
@ -578,7 +578,8 @@ TOKEN *CheckMemoryLeakClass::getcode(const TOKEN *tok, std::list<const TOKEN *>
|
||||||
|
|
||||||
// Assignment..
|
// Assignment..
|
||||||
if ( TOKEN::Match(tok,"[)=] %var1% [+;)]", varnames) ||
|
if ( TOKEN::Match(tok,"[)=] %var1% [+;)]", varnames) ||
|
||||||
TOKEN::Match(tok, "%var1% +=|-=", varnames) )
|
TOKEN::Match(tok, "%var1% +=|-=", varnames) ||
|
||||||
|
TOKEN::Match(tok, "+= %var1% ;", varnames) )
|
||||||
addtoken("use");
|
addtoken("use");
|
||||||
|
|
||||||
// Investigate function calls..
|
// Investigate function calls..
|
||||||
|
|
|
@ -1288,6 +1288,14 @@ private:
|
||||||
"}\n" );
|
"}\n" );
|
||||||
|
|
||||||
ASSERT_EQUALS( std::string(""), errout.str() );
|
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() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue