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

Method invalidFreeError

lib/checkother.cpp:2814–2821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2812}
2813
2814void CheckOtherImpl::invalidFreeError(const Token *tok, const std::string &allocation, bool inconclusive)
2815{
2816 std::string alloc = allocation;
2817 if (alloc != "new")
2818 alloc += "()";
2819 std::string deallocated = (alloc == "new") ? "deleted" : "freed";
2820 reportError(tok, Severity::error, "invalidFree", "Mismatching address is " + deallocated + ". The address you get from " + alloc + " must be " + deallocated + " without offset.", CWE(0U), inconclusive ? Certainty::inconclusive : Certainty::normal);
2821}
2822
2823
2824//---------------------------------------------------------------------------

Callers 1

getErrorMessagesMethod · 0.80

Calls 2

reportErrorFunction · 0.70
CWEClass · 0.70

Tested by

no test coverage detected