Main Content
Resource leak
File stream not closed before FILE
pointer
scope ends or pointer is reassigned
Description
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.
Risk
If you do not release file handles explicitly as soon as possible, a failure can occur due to exhaustion of resources.
Fix
Close a FILE
pointer before the end of its
scope, or before you assign the pointer to another stream.
Examples
Result Information
Group: Resource management |
Language: C | C++ |
Default: On for handwritten code, off for generated code |
Command-Line Syntax: RESOURCE_LEAK |
Impact: High |
Version History
Introduced in R2015bSee 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)