File stream not closed before FILE pointer
scope ends or pointer is reassigned
This defect occurs when you
open a file stream by using a FILE pointer but
do not close it before:
The end of the pointer’s scope.
Assigning the pointer to another stream.
If you do not release file handles explicitly as soon as possible, a failure can occur due to exhaustion of resources.
Close a FILE pointer before the end of its
scope, or before you assign the pointer to another stream.
| Group: Resource management |
| Language: C | C++ |
| Default: On for handwritten code, off for generated code |
Command-Line Syntax: RESOURCE_LEAK |
| Impact: High |
| CWE ID: 772 |