Skip to content

Commit 04c47db

Browse files
committed
add test
1 parent 140480f commit 04c47db

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/testleakautovar.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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"

0 commit comments

Comments
 (0)