Abnormal termination of exit handler
Exit handler function interrupts the normal execution of a program
Description
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
, orat_quick_exit()
.Some functions that can cause abnormal exits are
exit
,abort
,longjmp
, or (WinAPI)_onexit
.
Risk
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.
Fix
In inside exit handlers, remove calls to functions that prevent the exit handler from terminating normally.
Examples
Result Information
Group: Programming |
Language: C | C++ |
Default: Off |
Command-Line Syntax: EXIT_ABNORMAL_HANDLER |
Impact: Medium |
Version History
Introduced in R2016b
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)