From b95f0eaa419fd15bbe993c5ab3dd60fbf6a2e91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 8 Oct 2009 20:49:27 +0200 Subject: [PATCH] optimisation: made the memory leaks checking faster --- src/checkmemoryleak.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 66a915116..c04d7e0ac 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -1815,6 +1815,13 @@ void CheckMemoryLeakInFunction::checkScope(const Token *Tok1, const std::string } } + // If the variable is not allocated at all => no memory leak + if (Token::findmatch(tok, "alloc") == 0) + { + Tokenizer::deleteTokens(tok); + return; + } + simplifycode(tok, all); if (_settings->_debug && _settings->_verbose)