diff --git a/CheckMemoryLeak.cpp b/CheckMemoryLeak.cpp index ce7c41c43..bff3d3ec8 100644 --- a/CheckMemoryLeak.cpp +++ b/CheckMemoryLeak.cpp @@ -403,8 +403,22 @@ TOKEN *CheckMemoryLeakClass::getcode(const TOKEN *tok, std::list // assignment.. else - { - addtoken( "assign" ); + { + // is the pointer in rhs? + bool rhs = false; + for ( const TOKEN *tok2 = tok->tokAt(2); tok2; tok2 = tok2->next() ) + { + if ( tok2->str() == ";" ) + break; + + if ( tok2->str() == varname ) + { + rhs = true; + break; + } + } + + addtoken( rhs ? "use" : "assign" ); } }