@@ -466,6 +466,9 @@ bool CheckLeakAutoVar::checkScope(const Token * const startToken,
466466 const Token * closingParenthesis = tok->linkAt (1 );
467467 for (const Token *innerTok = tok->tokAt (2 ); innerTok && innerTok != closingParenthesis; innerTok = innerTok->next ()) {
468468 // TODO: replace with checkTokenInsideExpression()
469+ const Token* const openingPar = isFunctionCall (innerTok);
470+ if (!openingPar)
471+ checkTokenInsideExpression (innerTok, varInfo);
469472
470473 if (!isLocalVarNoAutoDealloc (innerTok, mTokenizer ->isCPP ()))
471474 continue ;
@@ -502,7 +505,6 @@ bool CheckLeakAutoVar::checkScope(const Token * const startToken,
502505 }
503506
504507 // check for function call
505- const Token * const openingPar = isFunctionCall (innerTok);
506508 if (openingPar) {
507509 const Library::AllocFunc* allocFunc = mSettings ->library .getDeallocFuncInfo (innerTok);
508510 // innerTok is a function name
@@ -805,7 +807,8 @@ bool CheckLeakAutoVar::checkScope(const Token * const startToken,
805807 const Token * vtok = typeEndTok->tokAt (3 );
806808 const VarInfo::AllocInfo allocation (af ? af->groupId : (arrayDelete ? NEW_ARRAY : NEW ), VarInfo::OWNED , ftok);
807809 changeAllocStatus (varInfo, allocation, vtok, vtok);
808- }
810+ } else if (Token::Match (tok, " %var% ." ))
811+ checkTokenInsideExpression (tok, varInfo);
809812 }
810813 ret (endToken, varInfo, true );
811814 return true ;
@@ -930,8 +933,7 @@ void CheckLeakAutoVar::changeAllocStatus(VarInfo &varInfo, const VarInfo::AllocI
930933void CheckLeakAutoVar::functionCall (const Token *tokName, const Token *tokOpeningPar, VarInfo &varInfo, const VarInfo::AllocInfo& allocation, const Library::AllocFunc* af)
931934{
932935 // Ignore function call?
933- if (mSettings ->library .isLeakIgnore (mSettings ->library .getFunctionName (tokName)))
934- return ;
936+ const bool isLeakIgnore = mSettings ->library .isLeakIgnore (mSettings ->library .getFunctionName (tokName));
935937 if (mSettings ->library .getReallocFuncInfo (tokName))
936938 return ;
937939
@@ -990,6 +992,8 @@ void CheckLeakAutoVar::functionCall(const Token *tokName, const Token *tokOpenin
990992 varAlloc.allocTok = arg;
991993 }
992994 }
995+ else if (isLeakIgnore)
996+ checkTokenInsideExpression (arg, varInfo);
993997 else
994998 changeAllocStatus (varInfo, dealloc.type == 0 ? allocation : dealloc, tokName, arg);
995999 }
0 commit comments