Fix FP leakNoVarFunctionCall with unknown function (#4242)
* 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
This commit is contained in:
parent
b90a726441
commit
06b408ea20
|
@ -1011,6 +1011,8 @@ void CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(const Scope *scope)
|
||||||
functionName == "return")
|
functionName == "return")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!tok->isKeyword() && mSettings->library.isNotLibraryFunction(tok))
|
||||||
|
continue;
|
||||||
if (!CheckMemoryLeakInFunction::test_white_list(functionName, mSettings, mTokenizer->isCPP()))
|
if (!CheckMemoryLeakInFunction::test_white_list(functionName, mSettings, mTokenizer->isCPP()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -2415,6 +2415,18 @@ private:
|
||||||
" return *strings_.insert(it, std::strcpy(new char[std::strlen(s) + 1], s));\n"
|
" return *strings_.insert(it, std::strcpy(new char[std::strlen(s) + 1], s));\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("struct S {\n"
|
||||||
|
" static void load(const QString & projPath) {\n"
|
||||||
|
" if (proj_)\n"
|
||||||
|
" return;\n"
|
||||||
|
" proj_ = new ProjectT(projPath);\n"
|
||||||
|
" proj_->open(new OpenCallback());\n"
|
||||||
|
" }\n"
|
||||||
|
"private:\n"
|
||||||
|
" static Core::ProjectBase* proj_;\n"
|
||||||
|
"};\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void missingAssignment() {
|
void missingAssignment() {
|
||||||
|
|
Loading…
Reference in New Issue