Skip to content

Commit 5b1d9e6

Browse files
author
Yehoshua Gev
committed
Fixed cppcheck-opensource#3888: memory leak through member function
1 parent 08a3d07 commit 5b1d9e6

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/checkmemoryleak.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2,
208208
}
209209

210210
// User function
211+
212+
while (Token::Match(tok2, "%var% .") || Token::Match(tok2, "%var% ::")) {
213+
tok2 = tok2->next()->next();
214+
}
215+
216+
if (!Token::Match(tok2, "%var% ("))
217+
return No;
218+
211219
const Token *ftok = tokenizer->getFunctionTokenByName(tok2->str().c_str());
212220
if (ftok == NULL)
213221
return No;

0 commit comments

Comments
 (0)