Memory leaks: Made CheckMemoryLeakInFunction experimental
This commit is contained in:
parent
1cf45a5cde
commit
690702a742
|
@ -34,7 +34,8 @@
|
|||
|
||||
// Register this check class (by creating a static instance of it)
|
||||
namespace {
|
||||
CheckMemoryLeakInFunction instance1;
|
||||
// Experimental (#3267 and #3268)
|
||||
// CheckMemoryLeakInFunction instance1;
|
||||
CheckMemoryLeakInClass instance2;
|
||||
CheckMemoryLeakStructMember instance3;
|
||||
CheckMemoryLeakNoVar instance4;
|
||||
|
@ -2379,6 +2380,10 @@ void CheckMemoryLeakInFunction::parseFunctionScope(const Token *tok, const Token
|
|||
|
||||
void CheckMemoryLeakInFunction::check()
|
||||
{
|
||||
// experimental checks. See #3267 and #3268
|
||||
if (!_settings->experimental)
|
||||
return;
|
||||
|
||||
// fill the "noreturn"
|
||||
parse_noreturn();
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ private:
|
|||
|
||||
Settings settings;
|
||||
settings.experimental = experimental;
|
||||
settings.experimental = true;
|
||||
|
||||
// Tokenize..
|
||||
Tokenizer tokenizer(&settings, this);
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
oss << "int main()\n"
|
||||
<< "{\n";
|
||||
for (int i = 0; i < 500; i++)
|
||||
oss << " {char *a = malloc(10);}\n";
|
||||
oss << " { int a = 4/0; }\n";
|
||||
|
||||
oss << " return 0;\n";
|
||||
oss << "}\n";
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
std::ostringstream oss;
|
||||
oss << "int main()\n"
|
||||
<< "{\n";
|
||||
oss << " {char *a = malloc(10);}\n";
|
||||
oss << " { int a = 4/0; }\n";
|
||||
oss << " return 0;\n";
|
||||
oss << "}\n";
|
||||
check(2, 1, 1, oss.str());
|
||||
|
@ -132,7 +132,7 @@ private:
|
|||
std::ostringstream oss;
|
||||
oss << "int main()\n"
|
||||
<< "{\n";
|
||||
oss << " {char *a = malloc(10);}\n";
|
||||
oss << " { int a = 4/0; }\n";
|
||||
oss << " return 0;\n";
|
||||
oss << "}\n";
|
||||
check(2, 20, 20, oss.str());
|
||||
|
|
Loading…
Reference in New Issue