...
Code Block | ||||
---|---|---|---|---|
| ||||
void cleanup(void) { /* deleteDelete temporary files, restore consistent state, etc */ } int main(void) { if (atexit(cleanup) != 0) { /* Handle error */ } /* ... */ if (/* something bad happened */) { exit(EXIT_FAILURE); } /* ... */ } |
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
...
ERR06-CPP. Understand the termination behavior of assert() and abort() | |
ISO/IEC TR 24772:2013 | Termination Strategy [REU] |
Bibliography
...
] | Section 7.2.1.1, "The assert macro," |
...
ISO/IEC PDTR 24772 "REU Termination strategy"
...
...