diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 1a17e0d2e..2caf92f66 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1875,7 +1875,7 @@ void CheckOther::unusedVariableError(const Token *tok, const std::string &varnam void CheckOther::allocatedButUnusedVariableError(const Token *tok, const std::string &varname) { - reportError(tok, Severity::style, "unusedVariable", "Variable '" + varname + "' is allocated memory that is never used"); + reportError(tok, Severity::style, "unusedAllocatedMemory", "Variable '" + varname + "' is allocated memory that is never used"); } void CheckOther::unreadVariableError(const Token *tok, const std::string &varname) diff --git a/test/testcppcheck.cpp b/test/testcppcheck.cpp index 582a6376d..af6e33883 100644 --- a/test/testcppcheck.cpp +++ b/test/testcppcheck.cpp @@ -77,6 +77,18 @@ private: ASSERT(!errorLogger.id.empty()); // TODO: check if there are duplicate error ids in errorLogger.id + std::string duplicate; + for (std::list::iterator it = errorLogger.id.begin(); + it != errorLogger.id.end(); + ++it) + { + if (std::find(errorLogger.id.begin(), it, *it) != it) + { + duplicate = "Duplicate ID: " + *it; + break; + } + } + ASSERT_EQUALS("", duplicate); } };