Fixed #8040 (False positive resourceLeak - handle assigned to class instead of scalar)
This commit is contained in:
parent
6417be4a71
commit
7161daefbd
|
@ -291,6 +291,8 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken,
|
||||||
// Possibly automatically deallocated memory
|
// Possibly automatically deallocated memory
|
||||||
if (!var->typeStartToken()->isStandardType() && Token::Match(varTok, "%var% = new"))
|
if (!var->typeStartToken()->isStandardType() && Token::Match(varTok, "%var% = new"))
|
||||||
continue;
|
continue;
|
||||||
|
if (!var->isPointer() && !var->typeStartToken()->isStandardType())
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocation?
|
// allocation?
|
||||||
|
|
|
@ -1208,6 +1208,9 @@ private:
|
||||||
|
|
||||||
check("void f() { Fred *p = new Fred; }", true);
|
check("void f() { Fred *p = new Fred; }", true);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("void f() { Fred fred = malloc(10); }", true);
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void throw1() { // 3987 - Execution reach a 'throw'
|
void throw1() { // 3987 - Execution reach a 'throw'
|
||||||
|
|
Loading…
Reference in New Issue