Fixed #2336 (False positive: memory leak (passing pointer to subfunction))

This commit is contained in:
Daniel Marjamäki 2010-12-21 21:12:45 +01:00
parent 0f9415a5fb
commit 6951c32683
2 changed files with 4 additions and 1 deletions

View File

@ -670,7 +670,7 @@ const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list<co
if (tok2->str() == "(" || tok2->str() == ")")
break;
if (tok2->varId() == varid)
return "use_";
return (tok->strAt(-1)==".") ? "use" : "use_";
}
return 0;

View File

@ -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"));
}