Skip to content

Commit

Permalink
Update testleakautovar.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Sep 25, 2024
1 parent 7396b19 commit 0cf3c6b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/testleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,15 @@ class TestLeakAutoVar : public TestFixture {
" return fclose(fd) == 0;\n"
"}\n", /*cpp*/ true);
ASSERT_EQUALS("", errout_str());

check("int f(const char* fileName) {\n" // #13136
" FILE* h = fopen(fileName, \"rb\");\n"
" if (fseek(h, 0L, SEEK_END) == -1)\n"
" fclose(h);\n"
" int i = ftell(h);\n"
" return i;\n"
"}\n");
ASSERT_EQUALS("[test.c:5]: (error) Dereferencing 'h' after it is deallocated / released\n", errout_str());
}

void doublefree1() { // #3895
Expand Down

0 comments on commit 0cf3c6b

Please sign in to comment.