Memory leaks: calling function that deallocates the memory and allocates new memory

https://apps.sourceforge.net/trac/cppcheck/ticket/336
This commit is contained in:
Daniel Marjamäki 2009-05-30 20:30:44 +02:00
parent fba1102689
commit bf98ff85e5
2 changed files with 3 additions and 3 deletions

View File

@ -1274,9 +1274,9 @@ void CheckMemoryLeakClass::CheckMemoryLeak_CheckScope(const Token *Tok1, const c
while (Token::Match(tok2, "[;{}] ;")) while (Token::Match(tok2, "[;{}] ;"))
erase(tok2, tok2->tokAt(2)); erase(tok2, tok2->tokAt(2));
} }
if ((result = Token::findmatch(tok, "dealloc [;{}] use|use_ ;")) != NULL) if ((result = Token::findmatch(tok, "[;{}] dealloc [;{}] use|use_ ;")) != NULL)
{ {
deallocuseError(result->tokAt(2), varname); deallocuseError(result->tokAt(3), varname);
} }
// Replace "&use" with "use". Replace "use_" with ";" // Replace "&use" with "use". Replace "use_" with ";"

View File

@ -2307,7 +2307,7 @@ private:
" delete [] a;\n" " delete [] a;\n"
" return 0;\n" " return 0;\n"
"}\n"); "}\n");
TODO_ASSERT_EQUALS(std::string(""), errout.str()); ASSERT_EQUALS(std::string(""), errout.str());
} }
}; };