Only check pointer that can be null at that point

This commit is contained in:
Dmitry-Me 2017-10-14 19:09:42 +03:00
parent 288ee96cc7
commit e4de220a2d
1 changed files with 2 additions and 2 deletions

View File

@ -155,10 +155,10 @@ void CheckSizeof::checkSizeofForPointerSize()
continue; continue;
} }
if (tokFunc && tokFunc->str() == "calloc") if (tokSize && tokFunc->str() == "calloc")
tokSize = tokSize->nextArgument(); tokSize = tokSize->nextArgument();
if (tokFunc && tokSize) { if (tokSize) {
const Token * const paramsListEndTok = tokFunc->linkAt(1); const Token * const paramsListEndTok = tokFunc->linkAt(1);
for (const Token* tok2 = tokSize; tok2 != paramsListEndTok; tok2 = tok2->next()) { for (const Token* tok2 = tokSize; tok2 != paramsListEndTok; tok2 = tok2->next()) {
if (Token::simpleMatch(tok2, "/ sizeof")) { if (Token::simpleMatch(tok2, "/ sizeof")) {