errmsg: use the error message dealloc-use

This commit is contained in:
Daniel Marjamäki 2009-02-06 06:22:44 +00:00
parent 7299d3e5b1
commit 3c7e40fe13
3 changed files with 5 additions and 7 deletions

View File

@ -1171,9 +1171,7 @@ void CheckMemoryLeakClass::CheckMemoryLeak_CheckScope(const Token *Tok1, const c
}
if ((result = Token::findmatch(tok, "dealloc [;{}] use|use_ ;")) != NULL)
{
std::ostringstream errmsg;
errmsg << _tokenizer->fileLine(result->tokAt(2)) << ": Using \"" << varname << "\" after it has been deallocated / released";
_errorLogger->reportErr(errmsg.str());
ErrorMessage::deallocuse(_errorLogger, _tokenizer, result->tokAt(2), varname);
}
// Replace "&use" with "use". Replace "use_" with ";"

View File

@ -63,7 +63,7 @@ private:
check(filedata);
// Compare results..
ASSERT_EQUALS("[file.cpp:5]: Using \"foo\" after it has been deallocated / released\n", errout.str());
ASSERT_EQUALS("[file.cpp:5]: (error) Using 'foo' after it is deallocated / released\n", errout.str());
}
void linenumbers2()

View File

@ -1669,7 +1669,7 @@ private:
" delete [] s;\n"
" p = s;\n"
"}\n");
ASSERT_EQUALS(std::string("[test.cpp:5]: Using \"s\" after it has been deallocated / released\n"), errout.str());
ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Using 's' after it is deallocated / released\n"), errout.str());
}
void dealloc_use_2()
@ -1714,7 +1714,7 @@ private:
" free(str);\n"
" char c = str[10];\n"
"}\n");
ASSERT_EQUALS(std::string("[test.cpp:5]: Using \"str\" after it has been deallocated / released\n"), errout.str());
ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Using 'str' after it is deallocated / released\n"), errout.str());
}
void dealloc_use_6()
@ -1736,7 +1736,7 @@ private:
" delete [] str;\n"
" str[10] = 0;\n"
"}\n");
ASSERT_EQUALS(std::string("[test.cpp:5]: Using \"str\" after it has been deallocated / released\n"), errout.str());
ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Using 'str' after it is deallocated / released\n"), errout.str());
}