diff options
author | Haru <haru@dotalux.com> | 2016-10-04 14:50:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-04 14:50:16 +0200 |
commit | ac94f6680069dcc682ed62dfe550f802b95a86ba (patch) | |
tree | 7492be266710d887f443d5f2d3406bdf77057296 /src/common/ers.c | |
parent | 55fbd44624651040d851ac14642aec605700890e (diff) | |
parent | b4e53a7da2789463354ea7b621e6751cb7f31811 (diff) | |
download | hercules-ac94f6680069dcc682ed62dfe550f802b95a86ba.tar.gz hercules-ac94f6680069dcc682ed62dfe550f802b95a86ba.tar.bz2 hercules-ac94f6680069dcc682ed62dfe550f802b95a86ba.tar.xz hercules-ac94f6680069dcc682ed62dfe550f802b95a86ba.zip |
Merge pull request #1452 from 4144/commonchecks
Add missing checks in common directory
Diffstat (limited to 'src/common/ers.c')
-rw-r--r-- | src/common/ers.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/common/ers.c b/src/common/ers.c index 8970fefc2..3e1cdc25b 100644 --- a/src/common/ers.c +++ b/src/common/ers.c @@ -149,7 +149,8 @@ static struct ers_instance_t *InstanceList = NULL; /** * @param Options the options from the instance seeking a cache, we use it to give it a cache with matching configuration **/ -static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) { +static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) +{ ers_cache_t *cache; for (cache = CacheList; cache; cache = cache->Next) @@ -187,6 +188,7 @@ static void ers_free_cache(ers_cache_t *cache, bool remove) { unsigned int i; + nullpo_retv(cache); for (i = 0; i < cache->Used; i++) aFree(cache->Blocks[i]); @@ -307,7 +309,8 @@ static void ers_obj_destroy(ERS *self) aFree(instance); } -void ers_cache_size(ERS *self, unsigned int new_size) { +void ers_cache_size(ERS *self, unsigned int new_size) +{ struct ers_instance_t *instance = (struct ers_instance_t *)self; nullpo_retv(instance); @@ -319,10 +322,11 @@ void ers_cache_size(ERS *self, unsigned int new_size) { instance->Cache->ChunkSize = new_size; } - ERS *ers_new(uint32 size, char *name, enum ERSOptions options) { struct ers_instance_t *instance; + + nullpo_retr(NULL, name); CREATE(instance,struct ers_instance_t, 1); size += sizeof(struct ers_list); @@ -359,7 +363,8 @@ ERS *ers_new(uint32 size, char *name, enum ERSOptions options) return &instance->VTable; } -void ers_report(void) { +void ers_report(void) +{ ers_cache_t *cache; unsigned int cache_c = 0, blocks_u = 0, blocks_a = 0, memory_b = 0, memory_t = 0; #ifdef DEBUG @@ -403,7 +408,8 @@ void ers_report(void) { /** * Call on shutdown to clear remaining entries **/ -void ers_final(void) { +void ers_final(void) +{ struct ers_instance_t *instance = InstanceList, *next; while( instance ) { |