diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 4c8bf37ae..13ba90dc9 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -2004,14 +2004,14 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens) { const Token *result; - if ((result = Token::findsimplematch(tokens, "loop alloc ;")) != nullptr) { - return result; - } - if (Token::Match(tokens, "alloc ; if|if(var)|ifv break|continue|return ;")) { return tokens->tokAt(3); } + if ((result = Token::findsimplematch(tokens, "loop alloc ;")) != nullptr) { + return result; + } + if ((result = Token::findmatch(tokens, "alloc ; if|if(var)|ifv return ;")) != nullptr) { return result->tokAt(3); }