diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 55912ad08..a6bfc374e 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -2029,7 +2029,7 @@ void CheckMemoryLeakStructMember::check() } // Deallocating the struct.. - else if (Token::Match(tok3, "free|kfree ( %varid% )", structid)) + else if (indentlevel2 == 0 && Token::Match(tok3, "free|kfree ( %varid% )", structid)) { memoryLeak(tok3, (vartok->str() + "." + tok2->strAt(2)).c_str(), Malloc, false); break; diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 04d996805..24b8dee38 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -2995,7 +2995,7 @@ private: " free(abc->a);\n" " free(abc);\n" "}\n"); - TODO_ASSERT_EQUALS("", errout.str()); + ASSERT_EQUALS("", errout.str()); } };