Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/checkmemoryleak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ void CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(const Scope *scope)
const Variable* argvar = tok->function()->getArgumentVar(argnr);
if (!argvar || !argvar->valueType())
continue;
const size_t argSize = argvar->valueType()->getSizeOf(*mSettings, ValueType::Accuracy::ExactOrZero, ValueType::SizeOf::Pointee);
const size_t argSize = argvar->valueType()->getSizeOf(*mSettings, ValueType::Accuracy::ExactOrZero, ValueType::SizeOf::Pointer);
if (argSize == 0 || argSize >= mSettings->platform.sizeof_pointer)
continue;
}
Expand Down
11 changes: 10 additions & 1 deletion test/testmemleak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,7 @@ class TestMemleakNoVar : public TestFixture {
"void x() {\n"
" set_error(strdup(p));\n"
"}");
ASSERT_EQUALS("[test.cpp:5:15]: (error) Allocation with strdup, set_error doesn't release it. [leakNoVarFunctionCall]\n", errout_str());
TODO_ASSERT_EQUALS("[test.cpp:5:15]: (error) Allocation with strdup, set_error doesn't release it. [leakNoVarFunctionCall]\n", "", errout_str());

check("void f()\n"
"{\n"
Expand Down Expand Up @@ -2502,6 +2502,15 @@ class TestMemleakNoVar : public TestFixture {
" f(new U());\n"
"}\n");
ASSERT_EQUALS("", errout_str());

check("struct A {\n" // #14339
" void g(int* p) { p_ = p; }\n"
" int *p_;\n"
"};\n"
"void f(A& a) {\n"
" a.g(new int);\n"
"}\n");
ASSERT_EQUALS("", errout_str());
}

void missingAssignment() {
Expand Down
Loading