Memory leak: Removed false positives. 'use ; use ;' is not always the same as 'use ;'
This commit is contained in:
parent
c2ea705fd7
commit
26bfab1c7e
|
@ -596,7 +596,7 @@ static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[]
|
|||
}
|
||||
|
||||
// Delete second use in "use ; use ;"
|
||||
while (Match(tok2, "use ; use ;"))
|
||||
while (Match(tok2, "[;{}] use ; use ;"))
|
||||
{
|
||||
erase(tok2, Tokenizer::gettok(tok2,3));
|
||||
done = false;
|
||||
|
|
|
@ -66,6 +66,7 @@ private:
|
|||
TEST_CASE( simple8 );
|
||||
|
||||
TEST_CASE( use1 );
|
||||
TEST_CASE( use2 );
|
||||
|
||||
TEST_CASE( ifelse1 );
|
||||
TEST_CASE( ifelse2 );
|
||||
|
@ -207,6 +208,19 @@ private:
|
|||
}
|
||||
|
||||
|
||||
void use2()
|
||||
{
|
||||
check( "void foo()\n"
|
||||
"{\n"
|
||||
" char *str = strdup(\"abc\");\n"
|
||||
" if ( abc ) { memset(str, 0, 3); }\n"
|
||||
" *somestr = str;\n"
|
||||
"}\n" );
|
||||
|
||||
ASSERT_EQUALS( std::string(""), errout.str() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue