diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2012-08-17 18:32:56 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2013-02-24 17:58:34 +0100 |
| commit | 1711be955b54b9d12431b341ea290bad406023cc (patch) | |
| tree | 3f667dab7e2ef59aa622035b5d95f4a00ab9b57a /src/base | |
| parent | 98042012a6c6e639c9736b32518dd082ca539615 (diff) | |
| download | zcatch-1711be955b54b9d12431b341ea290bad406023cc.tar.gz zcatch-1711be955b54b9d12431b341ea290bad406023cc.zip | |
fixed all the errors that the clang static analayzer found
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/system.c | 4 | ||||
| -rw-r--r-- | src/base/system.h | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/base/system.c b/src/base/system.c index a849e807..410cb699 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -80,7 +80,7 @@ void dbg_assert_imp(const char *filename, int line, int test, const char *msg) void dbg_break() { - *((unsigned*)0) = 0x0; + *((volatile unsigned*)0) = 0x0; } void dbg_msg(const char *sys, const char *fmt, ...) @@ -166,6 +166,8 @@ void *mem_alloc_debug(const char *filename, int line, unsigned size, unsigned al MEMTAIL *tail; MEMHEADER *header = (struct MEMHEADER *)malloc(size+sizeof(MEMHEADER)+sizeof(MEMTAIL)); dbg_assert(header != 0, "mem_alloc failure"); + if(!header) + return NULL; tail = (struct MEMTAIL *)(((char*)(header+1))+size); header->size = size; header->filename = filename; diff --git a/src/base/system.h b/src/base/system.h index 032cf785..7ba0c0a0 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -33,6 +33,13 @@ void dbg_assert(int test, const char *msg); #define dbg_assert(test,msg) dbg_assert_imp(__FILE__, __LINE__, test, msg) void dbg_assert_imp(const char *filename, int line, int test, const char *msg); + +#ifdef __clang_analyzer__ +#include <assert.h> +#undef dbg_assert +#define dbg_assert(test,msg) assert(test) +#endif + /* Function: dbg_break Breaks into the debugger. |