Null pointer: Fixed false positive
This commit is contained in:
parent
01b05618e5
commit
190a0040b7
|
@ -2431,7 +2431,7 @@ void CheckOther::nullPointerLinkedList()
|
||||||
}
|
}
|
||||||
--indentlevel4;
|
--indentlevel4;
|
||||||
}
|
}
|
||||||
else if (tok4->str() == "break")
|
else if (tok4->str() == "break" || tok4->str() == "return")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -925,6 +925,18 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkNullPointer("void f()\n"
|
||||||
|
"{\n"
|
||||||
|
" for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())\n"
|
||||||
|
" {\n"
|
||||||
|
" while (tok && tok->str() != \"{\")\n"
|
||||||
|
" tok = tok->next();\n"
|
||||||
|
" if (!tok)\n"
|
||||||
|
" return;\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// dynamic_cast..
|
// dynamic_cast..
|
||||||
checkNullPointer("void foo(ABC *abc)\n"
|
checkNullPointer("void foo(ABC *abc)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue