Main Content
Closing previously closed resource
Function closes a previously closed stream
Description
This defect occurs when a function attempts to close a stream that was closed earlier in your code and not reopened later.
Risk
The standard states that the value of a FILE*
pointer is
indeterminate after you close the stream associated with it. Performing the close
operation on the FILE*
pointer again can cause unwanted
behavior.
Fix
Remove the redundant close operation.
Examples
Result Information
Group: Resource management |
Language: C | C++ |
Default: On for handwritten code, off for generated code |
Command-Line Syntax:
DOUBLE_RESOURCE_CLOSE |
Impact: High |
Version History
Introduced in R2015b
See Also
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)