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

Method doubleFreeError

lib/checkleakautovar.cpp:152–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void CheckLeakAutoVarImpl::doubleFreeError(const Token *tok, const Token *prevFreeTok, const std::string &varname, int type)
153{
154 const std::list<const Token *> locations = { prevFreeTok, tok };
155
156 if (Library::isresource(type))
157 reportError(locations, Severity::error, "doubleFree", "$symbol:" + varname + "\nResource handle '$symbol' freed twice.", CWE415, Certainty::normal);
158 else
159 reportError(locations, Severity::error, "doubleFree", "$symbol:" + varname + "\nMemory pointed to by '$symbol' is freed twice.", CWE415, Certainty::normal);
160}
161
162
163void CheckLeakAutoVarImpl::check()

Callers 1

getErrorMessagesMethod · 0.80

Calls 2

isresourceFunction · 0.85
reportErrorFunction · 0.70

Tested by

no test coverage detected