Fixed #2473 (False positive: Memory leak when there is local struct)
This commit is contained in:
parent
959e10cee5
commit
065e2e277e
|
@ -921,7 +921,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok2->varId() == varid ||
|
if (tok2->varId() == varid ||
|
||||||
tok2->str() == ":")
|
tok2->str() == ":" || tok2->str() == "{")
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -520,6 +520,12 @@ private:
|
||||||
|
|
||||||
// ticket #2336: calling member function with same name as a white_list function
|
// ticket #2336: calling member function with same name as a white_list function
|
||||||
ASSERT_EQUALS(";;use;", getcode("char *s; foo.write(s);", "s"));
|
ASSERT_EQUALS(";;use;", getcode("char *s; foo.write(s);", "s"));
|
||||||
|
|
||||||
|
// #2473 - inner struct
|
||||||
|
ASSERT_EQUALS(";;alloc;{;;};dealloc;",
|
||||||
|
getcode("char *s = new char[10];\n"
|
||||||
|
"struct ab { int a, b; };\n"
|
||||||
|
"delete [] s;\n", "s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue