don't print style message if --enable=style is not given (#6627)

message was of type:
(style) Class 'foo' is unsafe, 'foo::bar' can leak by wrong usage.
This commit is contained in:
Matthias Krüger 2015-04-06 11:40:45 +02:00
parent 435a5d0bf9
commit 6ff9a52d8b
1 changed files with 3 additions and 0 deletions

View File

@ -2414,6 +2414,9 @@ void CheckMemoryLeakInClass::variable(const Scope *scope, const Token *tokVarnam
void CheckMemoryLeakInClass::unsafeClassError(const Token *tok, const std::string &classname, const std::string &varname)
{
if (!_settings->isEnabled("style"))
return;
reportError(tok, Severity::style, "unsafeClassCanLeak",
"Class '" + classname + "' is unsafe, '" + varname + "' can leak by wrong usage.\n"
"The class '" + classname + "' is unsafe, wrong usage can cause memory/resource leaks for '" + varname + "'. This can for instance be fixed by adding proper cleanup in the destructor.");