windows.cfg: Fixed configuration of _tfopen_s/_wfopen_s (
This commit is contained in:
parent
9a61559eca
commit
3916cd628e
|
@ -985,8 +985,8 @@
|
||||||
<resource>
|
<resource>
|
||||||
<alloc init="true">_wfopen</alloc>
|
<alloc init="true">_wfopen</alloc>
|
||||||
<alloc init="true">_tfopen</alloc>
|
<alloc init="true">_tfopen</alloc>
|
||||||
<alloc init="true">_wfopen_s</alloc>
|
<alloc init="true" arg="1">_wfopen_s</alloc>
|
||||||
<alloc init="true">_tfopen_s</alloc>
|
<alloc init="true" arg="1">_tfopen_s</alloc>
|
||||||
<dealloc>fclose</dealloc>
|
<dealloc>fclose</dealloc>
|
||||||
</resource>
|
</resource>
|
||||||
<memory>
|
<memory>
|
||||||
|
|
|
@ -5977,6 +5977,7 @@ private:
|
||||||
LOAD_LIB_2(settings.library, "windows.cfg");
|
LOAD_LIB_2(settings.library, "windows.cfg");
|
||||||
|
|
||||||
TEST_CASE(openfileNoLeak);
|
TEST_CASE(openfileNoLeak);
|
||||||
|
TEST_CASE(returnValueNotUsed_tfopen_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openfileNoLeak() {
|
void openfileNoLeak() {
|
||||||
|
@ -5992,6 +5993,24 @@ private:
|
||||||
"}");
|
"}");
|
||||||
TODO_ASSERT_EQUALS("", "[test.c:1]: (error) Resource leak: hFile\n", errout.str());
|
TODO_ASSERT_EQUALS("", "[test.c:1]: (error) Resource leak: hFile\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void returnValueNotUsed_tfopen_s() {
|
||||||
|
check("bool LoadFile(LPCTSTR filename) {\n"
|
||||||
|
" FILE *fp = NULL;\n"
|
||||||
|
" _tfopen_s(&fp, filename, _T(\"rb\"));\n"
|
||||||
|
" if (!fp)\n"
|
||||||
|
" return false;\n"
|
||||||
|
" fclose(fp);\n"
|
||||||
|
" return true;\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("bool LoadFile(LPCTSTR filename) {\n"
|
||||||
|
" FILE *fp = NULL;\n"
|
||||||
|
" _tfopen_s(&fp, filename, _T(\"rb\"));\n"
|
||||||
|
"}");
|
||||||
|
TODO_ASSERT_EQUALS("[test.c:3]: (error) Resource leak: fp\n", "", errout.str());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TEST(TestMemleakWindows)
|
REGISTER_TEST(TestMemleakWindows)
|
||||||
|
|
Loading…
Reference in New Issue