parent
277c59e5f3
commit
239b660a52
|
@ -999,7 +999,8 @@ void CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(const Scope *scope)
|
||||||
if ((mTokenizer->isCPP() && functionName == "delete") ||
|
if ((mTokenizer->isCPP() && functionName == "delete") ||
|
||||||
functionName == "free" ||
|
functionName == "free" ||
|
||||||
functionName == "fclose" ||
|
functionName == "fclose" ||
|
||||||
functionName == "realloc")
|
functionName == "realloc" ||
|
||||||
|
functionName == "return")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!CheckMemoryLeakInFunction::test_white_list(functionName, mSettings, mTokenizer->isCPP()))
|
if (!CheckMemoryLeakInFunction::test_white_list(functionName, mSettings, mTokenizer->isCPP()))
|
||||||
|
|
|
@ -2171,6 +2171,16 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:2]: (error) Allocation with calloc, memcmp doesn't release it.\n"
|
ASSERT_EQUALS("[test.cpp:2]: (error) Allocation with calloc, memcmp doesn't release it.\n"
|
||||||
"[test.cpp:2]: (error) Allocation with strdup, memcmp doesn't release it.\n", errout.str());
|
"[test.cpp:2]: (error) Allocation with strdup, memcmp doesn't release it.\n", errout.str());
|
||||||
|
|
||||||
|
check("void* f(int size) {\n"
|
||||||
|
" return (void*) malloc(size);\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("int* f(int size) {\n"
|
||||||
|
" return static_cast<int*>(malloc(size));\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void missingAssignment() {
|
void missingAssignment() {
|
||||||
|
|
Loading…
Reference in New Issue