memleak: fixed false positives for assignment in return statement (bug

2205568)
This commit is contained in:
Daniel Marjamäki 2008-11-02 10:33:38 +00:00
parent d60d133671
commit f1330c3db0
2 changed files with 19 additions and 3 deletions

View File

@ -76,6 +76,8 @@ private:
TEST_CASE( switch1 );
TEST_CASE( switch2 );
TEST_CASE( ret );
TEST_CASE( mismatch1 );
TEST_CASE( func1 );
@ -410,6 +412,20 @@ private:
void ret()
{
check( "char *f( char **str )\n"
"{\n"
" char *ret = malloc( 10 );\n"
" return *str = ret;\n"
"}\n" );
ASSERT_EQUALS( std::string(""), errout.str() );
}
void mismatch1()

View File

@ -888,9 +888,9 @@ void SimplifyTokenList()
continue;
TOKEN *type0 = tok->next;
if (!type0)
break;
if (strcmp(type0->str, "else") == 0)
if (!Match(type0, "%type%"))
continue;
if (Match(type0, "else") || Match(type0, "return"))
continue;
TOKEN *tok2 = NULL;