File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1117,6 +1117,8 @@ void CheckMemoryLeakNoVar::checkForUnusedReturnValue(const Scope *scope)
11171117 if (!(Token::simpleMatch (parent->astParent (), " ?" ) && !parent->astParent ()->astParent ()))
11181118 continue ;
11191119 }
1120+ if (tok->str () == " freopen" )
1121+ continue ;
11201122 returnValueNotUsedError (tok, tok->str ());
11211123 }
11221124 }
Original file line number Diff line number Diff line change @@ -2701,6 +2701,12 @@ class TestMemleakNoVar : public TestFixture {
27012701 " delete[] &p[-1];\n "
27022702 " }\n " );
27032703 ASSERT_EQUALS (" " , errout_str ());
2704+
2705+ check (" void f(FILE* fp1, FILE* fp2) {\n " // #14171
2706+ " if (freopen(NULL, \" w+b\" , fp1) == NULL) {}\n "
2707+ " if (std::freopen(NULL, \" w+b\" , fp2) == NULL) {}\n "
2708+ " }\n " );
2709+ ASSERT_EQUALS (" " , errout_str ());
27042710 }
27052711
27062712 void smartPointerFunctionParam () {
You can’t perform that action at this time.
0 commit comments