Skip to content

Commit

Permalink
nullptr check
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Mar 19, 2024
1 parent 52ab62f commit 15f4c73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 15f4c73

Please sign in to comment.