Fix FP leakNoVarFunctionCall (#4243)
* Fix #10857 FN: leakNoVarFunctionCall * Fix TODO * Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) ) * #11155 FN: leakNoVarFunctionCall (ternary operator) * Fix #11157 FN: leakNoVarFunctionCall (switch condition) * Fix FN constStatement * Fix FP leakNoVarFunctionCall * Fix FP leakNoVarFunctionCall * Format * Fix FP leakNoVarFunctionCall with unknown function * Fix FP leakNoVarFunctionCall
This commit is contained in:
parent
06b408ea20
commit
d8e64b4cbb
|
@ -1011,6 +1011,8 @@ void CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(const Scope *scope)
|
|||
functionName == "return")
|
||||
continue;
|
||||
|
||||
if (Token::simpleMatch(tok->next()->astParent(), "(")) // passed to another function
|
||||
continue;
|
||||
if (!tok->isKeyword() && mSettings->library.isNotLibraryFunction(tok))
|
||||
continue;
|
||||
if (!CheckMemoryLeakInFunction::test_white_list(functionName, mSettings, mTokenizer->isCPP()))
|
||||
|
|
|
@ -2427,6 +2427,12 @@ private:
|
|||
" static Core::ProjectBase* proj_;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(const std::string& s, int n) {\n"
|
||||
" std::unique_ptr<char[]> u;\n"
|
||||
" u.reset(strcpy(new char[n], s.c_str()));\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void missingAssignment() {
|
||||
|
|
Loading…
Reference in New Issue