Exit handler function interrupts the normal execution of a program
This defect occurs when an exit handler itself calls another function that interrupts the program’s expected termination sequence and causes an abnormal exit.
Exit handlers are functions designated for execution when a program
terminates. These functions are first registered with specific functions
such as atexit, (WinAPI) _onexit, or
at_quick_exit().
Some functions that can cause abnormal exits are exit,
abort, longjmp, or (WinAPI)
_onexit.
If your exit handler terminates your program, you can have undefined behavior. Abnormal program termination means other exit handlers are not invoked. These additional exit handlers may do additional clean up or other required termination steps.
In inside exit handlers, remove calls to functions that prevent the exit handler from terminating normally.
| Group: Programming |
| Language: C | C++ |
| Default: Off |
Command-Line Syntax: EXIT_ABNORMAL_HANDLER |
| Impact: Medium |
| CWE ID: 705 |