Fix FP leakNoVarFunctionCall (#5309)
This commit is contained in:
parent
23deadb370
commit
560982de94
|
@ -1004,7 +1004,8 @@ void CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(const Scope *scope)
|
|||
const Variable* argvar = tok->function()->getArgumentVar(argnr);
|
||||
if (!argvar || !argvar->valueType())
|
||||
continue;
|
||||
if (argvar->valueType()->typeSize(mSettings->platform, /*p*/ true) >= mSettings->platform.sizeof_pointer)
|
||||
const MathLib::bigint argSize = argvar->valueType()->typeSize(mSettings->platform, /*p*/ true);
|
||||
if (argSize <= 0 || argSize >= mSettings->platform.sizeof_pointer)
|
||||
continue;
|
||||
}
|
||||
functionCallLeak(arg, arg->str(), functionName);
|
||||
|
|
|
@ -2493,6 +2493,13 @@ private:
|
|||
" g(1, new int());\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(T t);\n"
|
||||
"struct U {};\n"
|
||||
"void g() {\n"
|
||||
" f(new U());\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void missingAssignment() {
|
||||
|
|
Loading…
Reference in New Issue