diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 0be88e33d..4252330db 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -670,7 +670,7 @@ const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::liststr() == "(" || tok2->str() == ")") break; if (tok2->varId() == varid) - return "use_"; + return (tok->strAt(-1)==".") ? "use" : "use_"; } return 0; diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index e657d09ec..2492e1c6d 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -507,6 +507,9 @@ private: "const int two = rand();\n" "return 0;\n" "}", "one"); + + // ticket #2336: calling member function with same name as a white_list function + ASSERT_EQUALS(";;use;", getcode("char *s; foo.write(s);", "s")); }