Fixed #5134 (Memory leak below CheckIO::checkWrongPrintfScanfArguments())

This commit is contained in:
Robert Reif 2013-11-01 05:42:37 +01:00 committed by Daniel Marjamäki
parent 3e13408da2
commit ac3b1c0611
2 changed files with 12 additions and 3 deletions

View File

@ -1421,6 +1421,16 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings)
}
}
CheckIO::ArgumentInfo::~ArgumentInfo()
{
if (tempToken) {
while (tempToken->next())
tempToken->deleteNext();
delete tempToken;
}
}
bool CheckIO::ArgumentInfo::isStdVectorOrString()
{
if (Token::Match(variableInfo->typeStartToken(), "std :: vector|array <")) {

View File

@ -72,9 +72,8 @@ private:
class ArgumentInfo {
public:
ArgumentInfo(const Token *arg, const Settings *settings);
~ArgumentInfo() {
delete tempToken;
}
~ArgumentInfo();
bool isArrayOrPointer() const;
bool isComplexType() const;
bool isKnownType() const;