From 6ff9a52d8beee6a7603aa71e53a94a6bac2f529f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 6 Apr 2015 11:40:45 +0200 Subject: [PATCH] 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. --- lib/checkmemoryleak.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 1d472658c..addf8b18c 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -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.");