All resources obtained dynamically by means of Standard Library functions shall be explicitly released
All resources obtained dynamically by means of Standard Library functions shall be explicitly released.
Resources are something that you must return to the system once you have used them. Examples include dynamically allocated memory and file descriptors.
If you do not release resources explicitly as soon as possible, then a failure can occur due to exhaustion of resources.
The checker flags uses of:
Memory-allocation functions such as malloc and
aligned_alloc if the memory is not
released.
File opening functions such as fopen if the file is
not closed.
You can check for this rule with a Bug Finder analysis only.
If you expect a rule violation but do not see it, refer to the documentation of Polyspace® Bug Finder™ or Polyspace Bug Finder Server™.
| Group: Resources |
| Category: Required |
| AGC Category: Required |