Skip to content

Commit e155074

Browse files
Update testleakautovar.cpp
1 parent 4e595f4 commit e155074

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

test/testleakautovar.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,8 +3179,8 @@ class TestLeakAutoVar : public TestFixture {
31793179
ASSERT_EQUALS("", errout_str());
31803180
}
31813181

3182-
void unconditionalScope() { // #14945
3183-
check("void f() {\n"
3182+
void unconditionalScope() {
3183+
check("void f() {\n" // #14945
31843184
" {\n"
31853185
" int* p = new int;\n"
31863186
" *p = 1;\n"
@@ -3195,6 +3195,16 @@ class TestLeakAutoVar : public TestFixture {
31953195
" delete r;\n"
31963196
"}\n", dinit(CheckOptions, $.cpp = true));
31973197
ASSERT_EQUALS("[test.cpp:5:5]: (error) Memory leak: p [memleak]\n", errout_str());
3198+
3199+
check("void f() {\n"
3200+
" int* p = new int;\n"
3201+
" {\n"
3202+
" (void)p;\n"
3203+
" }\n"
3204+
" *p = 1;\n"
3205+
" delete p;\n"
3206+
"}\n", dinit(CheckOptions, $.cpp = true));
3207+
ASSERT_EQUALS("", errout_str());
31983208
}
31993209

32003210
void functionCallCastConfig() { // #9652

0 commit comments

Comments
 (0)