diff --git a/lib/library.cpp b/lib/library.cpp index 1561f9c3ff9..15ba68c31c6 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -1076,7 +1076,7 @@ bool Library::isuninitargbad(const Token *ftok, int argnr, int indirect, bool *h const Library::AllocFunc* Library::getAllocFuncInfo(const Token *tok) const { while (Token::simpleMatch(tok, "::")) - tok = tok->astOperand2(); + tok = tok->astOperand2() ? tok->astOperand2() : tok->astOperand1(); const std::string funcname = getFunctionName(tok); return isNotLibraryFunction(tok) && functions.find(funcname) != functions.end() ? nullptr : getAllocDealloc(mAlloc, funcname); } @@ -1085,7 +1085,7 @@ const Library::AllocFunc* Library::getAllocFuncInfo(const Token *tok) const const Library::AllocFunc* Library::getDeallocFuncInfo(const Token *tok) const { while (Token::simpleMatch(tok, "::")) - tok = tok->astOperand2(); + tok = tok->astOperand2() ? tok->astOperand2() : tok->astOperand1(); const std::string funcname = getFunctionName(tok); return isNotLibraryFunction(tok) && functions.find(funcname) != functions.end() ? nullptr : getAllocDealloc(mDealloc, funcname); } @@ -1094,7 +1094,7 @@ const Library::AllocFunc* Library::getDeallocFuncInfo(const Token *tok) const const Library::AllocFunc* Library::getReallocFuncInfo(const Token *tok) const { while (Token::simpleMatch(tok, "::")) - tok = tok->astOperand2(); + tok = tok->astOperand2() ? tok->astOperand2() : tok->astOperand1(); const std::string funcname = getFunctionName(tok); return isNotLibraryFunction(tok) && functions.find(funcname) != functions.end() ? nullptr : getAllocDealloc(mRealloc, funcname); }