summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-27 17:55:12 +0300
committerAndrei Karas <akaras@inbox.ru>2016-10-04 15:33:43 +0300
commitfbee00b1c05cbdb4033fa7b7f4a021177d050667 (patch)
treeea222fab8613887284ca46814538e22022e959fc /src
parent4b0c4cbd183ca195d3a826d58169f38bc278cb66 (diff)
downloadhercules-fbee00b1c05cbdb4033fa7b7f4a021177d050667.tar.gz
hercules-fbee00b1c05cbdb4033fa7b7f4a021177d050667.tar.bz2
hercules-fbee00b1c05cbdb4033fa7b7f4a021177d050667.tar.xz
hercules-fbee00b1c05cbdb4033fa7b7f4a021177d050667.zip
Add missing checks into ers.c
Diffstat (limited to 'src')
-rw-r--r--src/common/ers.c16
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 ) {