updated error message when memory leaks upon exception
This commit is contained in:
parent
9a55f4ca43
commit
141b91ae08
|
@ -70,7 +70,7 @@ private:
|
||||||
/** Unsafe use of new */
|
/** Unsafe use of new */
|
||||||
void unsafeNewError(const Token * const tok)
|
void unsafeNewError(const Token * const tok)
|
||||||
{
|
{
|
||||||
reportError(tok, Severity::style, "exceptNew", "Upon exception there is memory leaks");
|
reportError(tok, Severity::style, "exceptNew", "Upon exception there are memory leaks");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Unsafe reallocation */
|
/** Unsafe reallocation */
|
||||||
|
|
|
@ -74,7 +74,7 @@ private:
|
||||||
const std::string AB("class A { }; class B { }; ");
|
const std::string AB("class A { }; class B { }; ");
|
||||||
|
|
||||||
check(AB + "C::C() : a(new A), b(new B) { }");
|
check(AB + "C::C() : a(new A), b(new B) { }");
|
||||||
ASSERT_EQUALS("[test.cpp:1]: (style) Upon exception there is memory leaks\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:1]: (style) Upon exception there are memory leaks\n", errout.str());
|
||||||
|
|
||||||
check("C::C() : a(new A), b(new B) { }");
|
check("C::C() : a(new A), b(new B) { }");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
@ -84,14 +84,14 @@ private:
|
||||||
" a = new A;\n"
|
" a = new A;\n"
|
||||||
" b = new B;\n"
|
" b = new B;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (style) Upon exception there is memory leaks\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (style) Upon exception there are memory leaks\n", errout.str());
|
||||||
|
|
||||||
check("void a()\n"
|
check("void a()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" A *a1 = new A;\n"
|
" A *a1 = new A;\n"
|
||||||
" A *a2 = new A;\n"
|
" A *a2 = new A;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (style) Upon exception there is memory leaks\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (style) Upon exception there are memory leaks\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void realloc()
|
void realloc()
|
||||||
|
|
Loading…
Reference in New Issue