diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 46e12b4ec..891714cc8 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1421,7 +1421,7 @@ void CheckClass::virtualDestructor() // pointer variables of type 'Base *' std::set basepointer; - for (std::size_t k = 0; k < symbolDatabase->getVariableListSize(); k++) { + for (std::size_t k = 1; k < symbolDatabase->getVariableListSize(); k++) { const Variable* var = symbolDatabase->getVariableFromVarId(k); if (var && var->isPointer() && var->type() == derivedFrom) basepointer.insert(var->declarationId()); diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 5f639d4e4..9f548be11 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -2207,7 +2207,7 @@ void CheckMemoryLeakInFunction::check() } // Check variables.. - for (unsigned int i = 0; i < symbolDatabase->getVariableListSize(); i++) { + for (unsigned int i = 1; i < symbolDatabase->getVariableListSize(); i++) { const Variable* var = symbolDatabase->getVariableFromVarId(i); if (!var || (!var->isLocal() && !var->isArgument()) || var->isStatic() || !var->scope()) continue; @@ -2449,7 +2449,7 @@ void CheckMemoryLeakInClass::publicAllocationError(const Token *tok, const std:: void CheckMemoryLeakStructMember::check() { const SymbolDatabase* symbolDatabase = _tokenizer->getSymbolDatabase(); - for (unsigned int i = 0; i < symbolDatabase->getVariableListSize(); i++) { + for (unsigned int i = 1; i < symbolDatabase->getVariableListSize(); i++) { const Variable* var = symbolDatabase->getVariableFromVarId(i); if (!var || !var->isLocal() || var->isStatic()) continue; diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 79eefaedb..ef67d469b 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2522,7 +2522,7 @@ void CheckOther::checkRedundantCopy() const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase(); - for (std::size_t i = 0; i < symbolDatabase->getVariableListSize(); i++) { + for (std::size_t i = 1; i < symbolDatabase->getVariableListSize(); i++) { const Variable* var = symbolDatabase->getVariableFromVarId(i); if (!var || var->isReference() || !var->isConst() || var->isPointer() || (!var->type() && !var->isStlType())) // bailout if var is of standard type, if it is a pointer or non-const