CheckMemoryLeakNoVar::returnValueNotUsedError: put function name into singlequotes

This commit is contained in:
Matthias Krüger 2015-07-31 13:52:21 +02:00
parent 83ee640977
commit 8bfbb5d09c
2 changed files with 8 additions and 8 deletions

View File

@ -2816,7 +2816,7 @@ void CheckMemoryLeakNoVar::functionCallLeak(const Token *loc, const std::string
void CheckMemoryLeakNoVar::returnValueNotUsedError(const Token *tok, const std::string &alloc) void CheckMemoryLeakNoVar::returnValueNotUsedError(const Token *tok, const std::string &alloc)
{ {
reportError(tok, Severity::error, "leakReturnValNotUsed", "Return value of allocation function " + alloc + " is not stored."); reportError(tok, Severity::error, "leakReturnValNotUsed", "Return value of allocation function '" + alloc + "' is not stored.");
} }
void CheckMemoryLeakNoVar::unsafeArgAllocError(const Token *tok, const std::string &funcName, const std::string &ptrType, const std::string& objType) void CheckMemoryLeakNoVar::unsafeArgAllocError(const Token *tok, const std::string &funcName, const std::string &ptrType, const std::string& objType)

View File

@ -6332,25 +6332,25 @@ private:
"{\n" "{\n"
" malloc(10);\n" " malloc(10);\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function malloc is not stored.\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function 'malloc' is not stored.\n", errout.str());
check("void x()\n" check("void x()\n"
"{\n" "{\n"
" calloc(10);\n" " calloc(10);\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function calloc is not stored.\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function 'calloc' is not stored.\n", errout.str());
check("void x()\n" check("void x()\n"
"{\n" "{\n"
" strdup(\"Test\");\n" " strdup(\"Test\");\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function strdup is not stored.\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function 'strdup' is not stored.\n", errout.str());
check("void x()\n" check("void x()\n"
"{\n" "{\n"
" (char*) malloc(10);\n" " (char*) malloc(10);\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function malloc is not stored.\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function 'malloc' is not stored.\n", errout.str());
check("void x()\n" check("void x()\n"
"{\n" "{\n"
@ -6370,7 +6370,7 @@ private:
"{\n" "{\n"
" 42,malloc(42);\n" " 42,malloc(42);\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function malloc is not stored.\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function 'malloc' is not stored.\n", errout.str());
check("void *f()\n" check("void *f()\n"
"{\n" "{\n"
@ -6380,13 +6380,13 @@ private:
"{\n" "{\n"
" f();\n" " f();\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:7]: (error) Return value of allocation function f is not stored.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (error) Return value of allocation function 'f' is not stored.\n", errout.str());
check("void x()\n" check("void x()\n"
"{\n" "{\n"
" if(!malloc(5)) fail();\n" " if(!malloc(5)) fail();\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function malloc is not stored.\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Return value of allocation function 'malloc' is not stored.\n", errout.str());
check("FOO* factory() {\n" check("FOO* factory() {\n"
" FOO* foo = new (std::nothrow) FOO;\n" " FOO* foo = new (std::nothrow) FOO;\n"