MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / unsafeClassError

Method unsafeClassError

lib/checkmemoryleak.cpp:643–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643void CheckMemoryLeakInClassImpl::unsafeClassError(const Token *tok, const std::string &classname, const std::string &varname)
644{
645 if (!mSettings.severity.isEnabled(Severity::style) && !mSettings.isPremiumEnabled("unsafeClassCanLeak"))
646 return;
647
648 reportError(tok, Severity::style, "unsafeClassCanLeak",
649 "$symbol:" + classname + "\n"
650 "$symbol:" + varname + "\n"
651 "Class '" + classname + "' is unsafe, '" + varname + "' can leak by wrong usage.\n"
652 "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.", CWE398, Certainty::normal);
653}
654
655
656void CheckMemoryLeakInClassImpl::checkPublicFunctions(const Scope *scope, const Token *classtok)

Callers 1

getErrorMessagesMethod · 0.80

Calls 3

isPremiumEnabledMethod · 0.80
reportErrorFunction · 0.70
isEnabledMethod · 0.45

Tested by

no test coverage detected