memleak: fixed false positives for assignment in return statement (bug
2205568)
This commit is contained in:
parent
d60d133671
commit
f1330c3db0
|
@ -76,6 +76,8 @@ private:
|
||||||
TEST_CASE( switch1 );
|
TEST_CASE( switch1 );
|
||||||
TEST_CASE( switch2 );
|
TEST_CASE( switch2 );
|
||||||
|
|
||||||
|
TEST_CASE( ret );
|
||||||
|
|
||||||
TEST_CASE( mismatch1 );
|
TEST_CASE( mismatch1 );
|
||||||
|
|
||||||
TEST_CASE( func1 );
|
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()
|
void mismatch1()
|
||||||
|
|
|
@ -888,9 +888,9 @@ void SimplifyTokenList()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TOKEN *type0 = tok->next;
|
TOKEN *type0 = tok->next;
|
||||||
if (!type0)
|
if (!Match(type0, "%type%"))
|
||||||
break;
|
continue;
|
||||||
if (strcmp(type0->str, "else") == 0)
|
if (Match(type0, "else") || Match(type0, "return"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TOKEN *tok2 = NULL;
|
TOKEN *tok2 = NULL;
|
||||||
|
|
Loading…
Reference in New Issue