parent
9579b12be9
commit
a4f8c44432
|
@ -562,25 +562,25 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken,
|
||||||
|
|
||||||
|
|
||||||
const Token * endToken = ftok->linkAt(1);
|
const Token * endToken = ftok->linkAt(1);
|
||||||
if(!Token::Match(endToken, "> %var% {|( %var%"))
|
if (!Token::Match(endToken, "> %var% {|( %var%"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool arrayDelete = false;
|
bool arrayDelete = false;
|
||||||
if(Token::findsimplematch(ftok->next(), "[ ]", endToken))
|
if (Token::findsimplematch(ftok->next(), "[ ]", endToken))
|
||||||
arrayDelete = true;
|
arrayDelete = true;
|
||||||
|
|
||||||
// Check deleter
|
// Check deleter
|
||||||
const Token * deleterToken = nullptr;
|
const Token * deleterToken = nullptr;
|
||||||
const Token * endDeleterToken = nullptr;
|
const Token * endDeleterToken = nullptr;
|
||||||
const Library::AllocFunc* af = nullptr;
|
const Library::AllocFunc* af = nullptr;
|
||||||
if(Token::Match(ftok, "unique_ptr < %type% ,")) {
|
if (Token::Match(ftok, "unique_ptr < %type% ,")) {
|
||||||
deleterToken = ftok->tokAt(4);
|
deleterToken = ftok->tokAt(4);
|
||||||
endDeleterToken = endToken;
|
endDeleterToken = endToken;
|
||||||
} else if(Token::Match(endToken, "> %var% {|( %var% ,")) {
|
} else if (Token::Match(endToken, "> %var% {|( %var% ,")) {
|
||||||
deleterToken = endToken->tokAt(5);
|
deleterToken = endToken->tokAt(5);
|
||||||
endDeleterToken = endToken->linkAt(2);
|
endDeleterToken = endToken->linkAt(2);
|
||||||
}
|
}
|
||||||
if(deleterToken) {
|
if (deleterToken) {
|
||||||
// Check if its a pointer to a function
|
// Check if its a pointer to a function
|
||||||
const Token * dtok = Token::findmatch(deleterToken, "& %name%", endDeleterToken);
|
const Token * dtok = Token::findmatch(deleterToken, "& %name%", endDeleterToken);
|
||||||
if (dtok) {
|
if (dtok) {
|
||||||
|
|
|
@ -48,8 +48,7 @@ public:
|
||||||
int type;
|
int type;
|
||||||
AllocInfo(int type_ = 0, AllocStatus status_ = NOALLOC) : status(status_), type(type_) {}
|
AllocInfo(int type_ = 0, AllocStatus status_ = NOALLOC) : status(status_), type(type_) {}
|
||||||
|
|
||||||
bool managed() const
|
bool managed() const {
|
||||||
{
|
|
||||||
return status < 0;
|
return status < 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue