From 697af4f7beac8488953472dacb81a363a0788a08 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sat, 28 Jan 2012 23:23:02 +0100 Subject: [PATCH] Improve 'CheckMemoryLeakInClass::check'. --- lib/checkmemoryleak.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 329c92b5b..b78e3ba5c 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -2401,9 +2401,12 @@ void CheckMemoryLeakInClass::check() if (scope->isClassOrStruct()) { std::list::const_iterator var; for (var = scope->varlist.begin(); var != scope->varlist.end(); ++var) { - if (!var->isStatic() && var->nameToken()->previous()->str() == "*") { + if (!var->isStatic() && var->isPointer()) { // allocation but no deallocation of private variables in public function.. - if (var->nameToken()->tokAt(-2)->isStandardType()) { + const Token *tok = var->typeStartToken(); + if (tok->str() == "const") + tok = tok->next(); + if (tok && tok->isStandardType()) { if (var->isPrivate()) checkPublicFunctions(&(*scope), var->nameToken());