File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 13
13
#include " error.hpp"
14
14
#include " gensio.hpp"
15
15
#include < stdio.h>
16
- #include < stdlib.h> /* exit() */
16
+ #include < stdlib.h> /* exit(), _exit() in MinGW */
17
17
#include < string.h> /* strlen() */
18
+ #include < unistd.h> /* _exit() on Linux */
18
19
#if _MSC_VER > 1000
19
20
# include " windows.h" /* ExitThread() */
20
21
#endif
@@ -88,8 +89,17 @@ GenBuffer::Writable& operator <<(GenBuffer::Writable& err,Error*) {
88
89
if (NULLP!=p->record ) Error::policy_top->err ->vi_write (p->record ->begin_ (), p->record ->getLength ());
89
90
p=p->next ;
90
91
}
91
- // if (level>=Error::policy_top->killer)
92
- Error::cexit (level);
92
+ /* __SANITIZE_ADDRESS__ indicates g++ -fsanitize=address. This feature
93
+ * detects memory leaks, and since sam2p is full of memory leaks on
94
+ * fatal errors, we don't want them reported. With _exit() and abort(),
95
+ * -fsanitize=address doesn't report memory leaks.
96
+ */
97
+ #if (USE_UEXIT_ON_FATAL_ERROR || __SANITIZE_ADDRESS__) && !(_MSC_VER > 1000)
98
+ _exit (level);
99
+ #else
100
+ // if (level>=Error::policy_top->killer)
101
+ Error::cexit (level);
102
+ #endif
93
103
}
94
104
/* Note that the order of error messages might be scrambled, i.e `printed'
95
105
* is printed before `recorded'.
You can’t perform that action at this time.
0 commit comments