Fixed #2338 (False positive: Deallocating a deallocated pointer)
This commit is contained in:
parent
6951c32683
commit
f392dbef95
|
@ -4102,7 +4102,7 @@ void Tokenizer::removeRedundantAssignment()
|
|||
const Token * const end = tok->next()->link();
|
||||
for (Token *tok2 = tok->next(); tok2 && tok2 != end; tok2 = tok2->next())
|
||||
{
|
||||
if (Token::Match(tok2, "[;{}] %type% * %var% ;"))
|
||||
if (Token::Match(tok2, "[;{}] %type% * %var% ;") && tok2->strAt(1) != "return")
|
||||
{
|
||||
tok2 = tok2->tokAt(3);
|
||||
localvars.insert(tok2->varId());
|
||||
|
|
|
@ -4348,6 +4348,7 @@ private:
|
|||
{
|
||||
ASSERT_EQUALS("void f ( ) { ; int * q ; }", tokenizeAndStringify("void f() { int *p, *q; p = q; }", true));
|
||||
ASSERT_EQUALS("void f ( ) { ; int * q ; }", tokenizeAndStringify("void f() { int *p = 0, *q; p = q; }", true));
|
||||
ASSERT_EQUALS("int f ( int * x ) { return * x ; }", tokenizeAndStringify("int f(int *x) { return *x; }", true));
|
||||
}
|
||||
|
||||
void removedeclspec()
|
||||
|
|
Loading…
Reference in New Issue