diff --git a/lib/checkleakautovar.cpp b/lib/checkleakautovar.cpp index 264502acf0b..45bfb2f43b7 100644 --- a/lib/checkleakautovar.cpp +++ b/lib/checkleakautovar.cpp @@ -936,7 +936,7 @@ void CheckLeakAutoVar::ret(const Token *tok, const VarInfo &varInfo) continue; tok2 = tok2->next(); - while (tok2 && tok2->isCast() && (tok2->valueType()->pointer || (tok2->valueType()->typeSize(*mSettings) >= mSettings->sizeof_pointer))) + while (tok2 && tok2->isCast() && (tok2->valueType() && (tok2->valueType()->pointer || (tok2->valueType()->typeSize(*mSettings) >= mSettings->sizeof_pointer)))) tok2 = tok2->astOperand2() ? tok2->astOperand2() : tok2->astOperand1(); if (Token::Match(tok2, "%varid%", varid)) tok2 = tok2->next();