parent
c636641e67
commit
9810bad869
|
@ -125,6 +125,7 @@ private:
|
|||
TEST_CASE(doublefree11);
|
||||
TEST_CASE(doublefree12); // #10502
|
||||
TEST_CASE(doublefree13); // #11008
|
||||
TEST_CASE(doublefree14); // #9708
|
||||
|
||||
// exit
|
||||
TEST_CASE(exit1);
|
||||
|
@ -1454,6 +1455,27 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void doublefree14() { // #9708
|
||||
check("using namespace std;\n"
|
||||
" \n"
|
||||
"int main()\n"
|
||||
"{\n"
|
||||
" int *i = new int;\n"
|
||||
" unique_ptr<int> x(i);\n"
|
||||
" delete i;\n"
|
||||
"}", true);
|
||||
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:7]: (error) Memory pointed to by 'i' is freed twice.\n", errout.str());
|
||||
|
||||
check("using namespace std;\n"
|
||||
" \n"
|
||||
"int main()\n"
|
||||
"{\n"
|
||||
" int *i = new int;\n"
|
||||
" unique_ptr<int> x(i);\n"
|
||||
"}", true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void exit1() {
|
||||
check("void f() {\n"
|
||||
" char *p = malloc(10);\n"
|
||||
|
|
Loading…
Reference in New Issue