diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 206c973ad..2184ce0ab 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -224,6 +224,7 @@ private: TEST_CASE(dir_functions); TEST_CASE(pointer_to_pointer); + TEST_CASE(dealloc_and_alloc_in_func); } @@ -2290,6 +2291,25 @@ private: "}\n"); ASSERT_EQUALS(std::string(""), errout.str()); } + + void dealloc_and_alloc_in_func() + { + check("char *f( const char *x )\n" + "{\n" + " delete [] x;\n" + " return new char[10];\n" + "}\n" + "\n" + "int main()\n" + "{\n" + " char *a=0;\n" + " a = f( a );\n" + " a[0] = 1;\n" + " delete [] a;\n" + " return 0;\n" + "}\n"); + TODO_ASSERT_EQUALS(std::string(""), errout.str()); + } }; REGISTER_TEST(TestMemleak) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 96e01ad7c..ea13a2bde 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -157,7 +157,7 @@ private: } - std::string tokenizeAndStringify(const char code[], bool simplify=false) + std::string tokenizeAndStringify(const char code[], bool simplify = false) { // tokenize.. Tokenizer tokenizer;