Fixed #2443 (Possible null pointer dereference: xxx - otherwise it is redundant to check if xxx is null at line)
This commit is contained in:
parent
2d92f1ff6a
commit
9658e2299d
|
@ -461,6 +461,11 @@ void CheckNullPointer::nullPointerByDeRefAndChec()
|
|||
break;
|
||||
}
|
||||
|
||||
if (tok1->str() == ")" && Token::Match(tok1->link()->previous(), "while ( %varid%", varid))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (tok1->varId() == varid && !Token::Match(tok1->previous(), "[?:]"))
|
||||
{
|
||||
// unknown : this is set by isPointerDeRef if it is
|
||||
|
|
|
@ -405,6 +405,18 @@ private:
|
|||
" ;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("BOOL GotoFlyAnchor()\n" // #2243
|
||||
"{\n"
|
||||
" const SwFrm* pFrm = GetCurrFrm();\n"
|
||||
" do {\n"
|
||||
" pFrm = pFrm->GetUpper();\n"
|
||||
" } while( pFrm && !pFrm->IsFlyFrm() );\n"
|
||||
"\n"
|
||||
" if( !pFrm )\n"
|
||||
" return FALSE;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void nullpointer5()
|
||||
|
|
Loading…
Reference in New Issue