From 784fc0d33e9e3bfee9f9007550f59e5c24608a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 1 Jan 2009 10:02:53 +0000 Subject: [PATCH] Memory leak : Fixed a bug in getcode (assignment) --- checkmemoryleak.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/checkmemoryleak.cpp b/checkmemoryleak.cpp index 9bf8d9bda..ad3355ef6 100644 --- a/checkmemoryleak.cpp +++ b/checkmemoryleak.cpp @@ -421,12 +421,13 @@ TOKEN *CheckMemoryLeakClass::getcode(const TOKEN *tok, std::list { // is the pointer in rhs? bool rhs = false; - for ( const TOKEN *tok2 = tok->tokAt(2); tok2; tok2 = tok2->next() ) + std::string pattern("[=+] " + std::string(varname)); + for ( const TOKEN *tok2 = tok; tok2; tok2 = tok2->next() ) { if ( tok2->str() == ";" ) break; - if ( tok2->str() == varname ) + if ( TOKEN::Match(tok2, pattern.c_str()) ) { rhs = true; break;