Realloc: changed the error message. I think it's better to mention realloc in the message.
This commit is contained in:
parent
b5da0b8ed2
commit
49626e427e
|
@ -340,7 +340,7 @@ void CheckMemoryLeak::memleakError(const Token *tok, const std::string &varname)
|
||||||
|
|
||||||
void CheckMemoryLeak::memleakUponReallocFailureError(const Token *tok, const std::string &varname)
|
void CheckMemoryLeak::memleakUponReallocFailureError(const Token *tok, const std::string &varname)
|
||||||
{
|
{
|
||||||
reportErr(tok, Severity::error, "memleakOnRealloc", "Memory leak: \"" + varname + "\" nulled but not freed upon failure");
|
reportErr(tok, Severity::error, "memleakOnRealloc", "Common realloc mistake: \"" + varname + "\" nulled but not freed upon failure");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckMemoryLeak::resourceLeakError(const Token *tok, const std::string &varname)
|
void CheckMemoryLeak::resourceLeakError(const Token *tok, const std::string &varname)
|
||||||
|
|
|
@ -1089,7 +1089,7 @@ private:
|
||||||
" ;\n"
|
" ;\n"
|
||||||
" free(buf);\n"
|
" free(buf);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: \"buf\" nulled but not freed upon failure\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:6]: (error) Common realloc mistake: \"buf\" nulled but not freed upon failure\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void if11()
|
void if11()
|
||||||
|
@ -1178,7 +1178,7 @@ private:
|
||||||
"\n"
|
"\n"
|
||||||
" return a;\n"
|
" return a;\n"
|
||||||
"}\n", true);
|
"}\n", true);
|
||||||
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: \"a\" nulled but not freed upon failure\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:9]: (error) Common realloc mistake: \"a\" nulled but not freed upon failure\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1199,7 +1199,7 @@ private:
|
||||||
"\n"
|
"\n"
|
||||||
" return a;\n"
|
" return a;\n"
|
||||||
"}\n", true);
|
"}\n", true);
|
||||||
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: \"a\" nulled but not freed upon failure\n"
|
ASSERT_EQUALS("[test.cpp:9]: (error) Common realloc mistake: \"a\" nulled but not freed upon failure\n"
|
||||||
"[test.cpp:11]: (error) Memory leak: a\n", errout.str());
|
"[test.cpp:11]: (error) Memory leak: a\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1932,7 +1932,7 @@ private:
|
||||||
" char *a = (char *)malloc(10);\n"
|
" char *a = (char *)malloc(10);\n"
|
||||||
" a = realloc(a, 100);\n"
|
" a = realloc(a, 100);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) Memory leak: \"a\" nulled but not freed upon failure\n"
|
ASSERT_EQUALS("[test.cpp:4]: (error) Common realloc mistake: \"a\" nulled but not freed upon failure\n"
|
||||||
"[test.cpp:5]: (error) Memory leak: a\n", errout.str());
|
"[test.cpp:5]: (error) Memory leak: a\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1945,7 +1945,7 @@ private:
|
||||||
" free(a);\n"
|
" free(a);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) Memory leak: \"a\" nulled but not freed upon failure\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (error) Common realloc mistake: \"a\" nulled but not freed upon failure\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void realloc3()
|
void realloc3()
|
||||||
|
|
Loading…
Reference in New Issue