From: Christophe CURIS <christophe.cu...@free.fr>

As pointed by Coverity (#50074), despite the expected behaviour that
'wmalloc' should never return NULL, it may still happen if an abort handler
set by user (with wsetabort) does not call exit() as expected. In such
case we call exit ourself to be sure not to return NULL.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 WINGs/memory.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/WINGs/memory.c b/WINGs/memory.c
index 7f4f0a8..81476e4 100644
--- a/WINGs/memory.c
+++ b/WINGs/memory.c
@@ -30,6 +30,10 @@
 #include <assert.h>
 #include <signal.h>
 
+#ifdef HAVE_STDNORETURN
+#include <stdnoreturn.h>
+#endif
+
 #ifdef USE_BOEHM_GC
 #ifndef GC_DEBUG
 #define GC_DEBUG
@@ -54,7 +58,11 @@ static void defaultHandler(int bla)
 
 static waborthandler *aborthandler = defaultHandler;
 
-#define wAbort(a) (*aborthandler)(a)
+static inline noreturn void wAbort(int bla)
+{
+       (*aborthandler)(bla);
+       exit(-1);
+}
 
 waborthandler *wsetabort(waborthandler * handler)
 {
-- 
1.9.2


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to