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:
chrchr-github 2022-06-29 13:43:17 +02:00 committed by GitHub
parent b90a726441
commit 06b408ea20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -1011,6 +1011,8 @@ void CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(const Scope *scope)
functionName == "return")
continue;
if (!tok->isKeyword() && mSettings->library.isNotLibraryFunction(tok))
continue;
if (!CheckMemoryLeakInFunction::test_white_list(functionName, mSettings, mTokenizer->isCPP()))
continue;

View File

@ -2415,6 +2415,18 @@ private:
" return *strings_.insert(it, std::strcpy(new char[std::strlen(s) + 1], s));\n"
"}\n");
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() {