parent
31ea13eb0c
commit
7f28edbe26
|
@ -579,6 +579,8 @@ void CheckMemoryLeakInClass::variable(const Scope *scope, const Token *tokVarnam
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (!func.functionScope) // defaulted destructor
|
||||
continue;
|
||||
bool body = false;
|
||||
const Token *end = func.functionScope->bodyEnd;
|
||||
for (const Token *tok = func.arg->link(); tok != end; tok = tok->next()) {
|
||||
|
|
|
@ -521,6 +521,7 @@ private:
|
|||
TEST_CASE(class23); // ticket #3303
|
||||
TEST_CASE(class24); // ticket #3806 - false positive in copy constructor
|
||||
TEST_CASE(class25); // ticket #4367 - false positive implementation for destructor is not seen
|
||||
TEST_CASE(class26); // ticket #10789
|
||||
|
||||
TEST_CASE(staticvar);
|
||||
|
||||
|
@ -1450,6 +1451,17 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void class26() { // ticket #10789 - crash
|
||||
check("class C;\n"
|
||||
"struct S {\n"
|
||||
" S() { p = new C; }\n"
|
||||
" ~S();\n"
|
||||
" C* p;\n"
|
||||
"};\n"
|
||||
"S::~S() = default;\n");
|
||||
ASSERT_EQUALS("[test.cpp:5]: (style) Class 'S' is unsafe, 'S::p' can leak by wrong usage.\n", errout.str());
|
||||
}
|
||||
|
||||
void staticvar() {
|
||||
check("class A\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue