| 1209 | } |
| 1210 | |
| 1211 | void CheckMemoryLeakNoVarImpl::unsafeArgAllocError(const Token *tok, const std::string &funcName, const std::string &ptrType, const std::string& objType) |
| 1212 | { |
| 1213 | const std::string factoryFunc = ptrType == "shared_ptr" ? "make_shared" : "make_unique"; |
| 1214 | reportError(tok, Severity::warning, "leakUnsafeArgAlloc", |
| 1215 | "$symbol:" + funcName + "\n" |
| 1216 | "Unsafe allocation. If $symbol() throws, memory could be leaked. Use " + factoryFunc + "<" + objType + ">() instead.", |
| 1217 | CWE401, |
| 1218 | Certainty::inconclusive); // Inconclusive because funcName may never throw |
| 1219 | } |
| 1220 | |
| 1221 | void CheckMemoryLeakNoVar::runChecks(const Tokenizer &tokenizer, ErrorLogger& errorLogger) |
| 1222 | { |
no test coverage detected