| 509 | //--------------------------------------------------------------------------- |
| 510 | |
| 511 | void CheckMemoryLeakInClassImpl::check() |
| 512 | { |
| 513 | logChecker("CheckMemoryLeakInClass::check"); |
| 514 | |
| 515 | const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase(); |
| 516 | |
| 517 | // only check classes and structures |
| 518 | for (const Scope * scope : symbolDatabase->classAndStructScopes) { |
| 519 | for (const Variable &var : scope->varlist) { |
| 520 | if (!var.isStatic() && (var.isPointer() || var.isPointerArray())) { |
| 521 | // allocation but no deallocation of private variables in public function.. |
| 522 | const Token *tok = var.typeStartToken(); |
| 523 | // Either it is of standard type or a non-derived type |
| 524 | if (tok->isStandardType() || (var.type() && var.type()->derivedFrom.empty())) { |
| 525 | if (var.isPrivate()) |
| 526 | checkPublicFunctions(scope, var.nameToken()); |
| 527 | |
| 528 | variable(scope, var.nameToken()); |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | |
| 536 | void CheckMemoryLeakInClassImpl::variable(const Scope *scope, const Token *tokVarname) |
no test coverage detected