checkunusedvar: Check pointer against NULL before dereferencing it.
This commit is contained in:
parent
2c12071065
commit
a81920cae1
|
@ -973,7 +973,7 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer, Alloc al
|
|||
const Token *parent = vartok->next()->astParent();
|
||||
while (Token::Match(parent, "[|."))
|
||||
parent = parent->astParent();
|
||||
if (Token::simpleMatch(parent, "&") && !parent->astOperand2())
|
||||
if (parent && Token::simpleMatch(parent, "&") && !parent->astOperand2())
|
||||
return false;
|
||||
if (parent && Token::Match(parent->previous(), "if|while|switch ("))
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue