File tree 1 file changed +3
-6
lines changed
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -638,8 +638,7 @@ class TestLeakAutoVar : public TestFixture {
638
638
639
639
void memcpyWithPtr1 () { // #11542
640
640
const Settings s = settingsBuilder ().library (" std.cfg" ).library (" posix.cfg" ).build ();
641
- check (" #include <string.h>\n "
642
- " void f(char** old, char* value) {\n "
641
+ check (" void f(char** old, char* value) {\n "
643
642
" char *str = strdup(value);\n "
644
643
" memcpy(old, &str, sizeof(char*));\n "
645
644
" }\n " , &s);
@@ -648,14 +647,12 @@ class TestLeakAutoVar : public TestFixture {
648
647
649
648
void memcpyWithPtr2 () {
650
649
const Settings s = settingsBuilder ().library (" std.cfg" ).library (" posix.cfg" ).build ();
651
- check (" #include <string.h>\n "
652
- " void f(char* value) {\n "
650
+ check (" void f(char* value) {\n "
653
651
" char *old = NULL;\n "
654
652
" char *str = strdup(value);\n "
655
653
" memcpy(&old, &str, sizeof(char*));\n "
656
654
" }\n " , &s);
657
- // TODO: make this fail
658
- ASSERT_EQUALS (" " , errout_str ());
655
+ ASSERT_EQUALS (" [test.cpp:5]: (error) Memory leak: old\n " , errout_str ());
659
656
}
660
657
661
658
void isAutoDealloc () {
You can’t perform that action at this time.
0 commit comments