File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ class TestLeakAutoVar : public TestFixture {
180180 TEST_CASE (return9);
181181 TEST_CASE (return10);
182182 TEST_CASE (return11); // #13098
183+ TEST_CASE (return12); // #12238
183184
184185 // General tests: variable type, allocation type, etc
185186 TEST_CASE (test1);
@@ -2832,6 +2833,17 @@ class TestLeakAutoVar : public TestFixture {
28322833 ASSERT_EQUALS (" [test.c:7:5]: (error) Memory leak: ptr [memleak]\n " , errout_str ());
28332834 }
28342835
2836+ void return12 () { // #12238
2837+ CheckOptions options;
2838+ options.cpp = true ;
2839+ check (" void f(size_t size) {\n "
2840+ " void* buffer = malloc(size);\n "
2841+ " std::vector<void*> v{ buffer };\n "
2842+ " x->g(p);\n "
2843+ " }\n " , options);
2844+ ASSERT_EQUALS (" " , errout_str ());
2845+ }
2846+
28352847 void test1 () {
28362848 check (" void f(double*&p) {\n " // 3809
28372849 " p = malloc(0x100);\n "
You can’t perform that action at this time.
0 commit comments