From 70a9fa246c2ce8471f47f33e8cea703235bbf1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 16 Apr 2008 15:22:50 +0000 Subject: [PATCH] CheckMemoryLeak: A few tweaks to make it report less false positives against the linux kernel --- CheckMemoryLeak.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CheckMemoryLeak.cpp b/CheckMemoryLeak.cpp index 867808c71..c09244256 100644 --- a/CheckMemoryLeak.cpp +++ b/CheckMemoryLeak.cpp @@ -14,9 +14,6 @@ #include #endif -//--------------------------------------------------------------------------- - -extern bool ShowAll; //--------------------------------------------------------------------------- @@ -207,9 +204,17 @@ static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[] // foo( var1 ); if ( Match( tok, "[=,(] %var1% [,);]", varnames ) ) return; - if ( Match( tok, "= ( %type% * ) %var1% ;", varnames ) ) + if ( Match( tok, "[=,(] ( %type% * ) %var1% [,);]", varnames ) ) + return; + if ( Match( tok, "[=,(] ( %type% %type% * ) %var1% [,);]", varnames ) ) return; + // Linux lists.. + if ( Match( tok, "%var% ( & %var1% .", varnames ) ) + { + if ( strstr(tok->str, "list_add") ) + return; + } // continue/break loop.. if (Alloc != No &&