...
In this noncompliant code example, the exit1() and exit2() functions are registered by atexit() to perform required cleanup upon program termination. However, if some_condition evaluates to true, exit() is called a second time, resulting in undefined behavior.
...
A function that is registered as an exit handler by atexit() must exit by returning , and not in any other manner:
...