forked from log4cplus/log4cplus
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/work around GitHub bug log4cplus#155.
Here we check that we can get CRT's heap handle because if we do not then the following `delete` will fail with access violation in `RtlFreeHeap()`. How is it possible that the CRT heap handle is NULL? This function can be called from TLS initializer/terminator by loader when log4cplus is compiled and linked to as a static library. In case of other threads temination, it should do its job and free per-thread data. However, when the whole process is being terminated, it is called after the CRT has been uninitialized and the CRT heap is not available any more. In such case, instead of crashing, we just give up and leak the memory for the short while before the process terminates anyway. It is possible to work around this situation in user application by calling `threadCleanup()` manually before `main()` exits.
- Loading branch information
Showing
1 changed file
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters