diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index b6d3b49a8..de2f2bff4 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -1522,20 +1522,14 @@ void CheckUninitVar::valueFlowUninit() continue; if (v->indirect > 1 || v->indirect < 0) continue; - if (v->indirect == 0 && tok->valueType() && tok->valueType()->pointer == 0 && !isVariableUsage(tok, false, NO_ALLOC, 0)) - continue; bool uninitderef = false; if (tok->variable()) { bool unknown; const bool isarray = !tok->variable() || tok->variable()->isArray(); const bool ispointer = astIsPointer(tok) && !isarray; const bool deref = CheckNullPointer::isPointerDeRef(tok, unknown, mSettings); - if (ispointer && !deref) { - if (v->indirect >= 1) - continue; - if (!isVariableUsage(tok, true, NO_ALLOC, 0)) - continue; - } + if (ispointer && v->indirect == 1 && !deref) + continue; if (isarray && !deref) continue; uninitderef = deref && v->indirect == 0; @@ -1546,6 +1540,9 @@ void CheckUninitVar::valueFlowUninit() if (!(Token::Match(tok->astParent(), ". %name% (") && uninitderef) && isVariableChanged(tok, v->indirect, mSettings, mTokenizer->isCPP())) continue; + bool inconclusive = false; + if (isVariableChangedByFunctionCall(tok, v->indirect, mSettings, &inconclusive) || inconclusive) + continue; uninitvarError(tok, tok->expressionString(), v->errorPath); const Token* nextTok = nextAfterAstRightmostLeaf(parent); if (nextTok == scope->bodyEnd)