SILC_LOG_DEBUG(("Allocating new cache"));
cache = silc_calloc(1, sizeof(*cache));
+ if (!cache)
+ return NULL;
cache->id_table = silc_hash_table_alloc(count, silc_hash_id,
(void *)(SilcUInt32)id_type,
silc_hash_id_compare,
cache->destructor = destructor;
cache->type = id_type;
+ if (!cache->id_table || !cache->name_table || !cache->context_table) {
+ if (cache->id_table)
+ silc_hash_table_free(cache->id_table);
+ if (cache->name_table)
+ silc_hash_table_free(cache->name_table);
+ if (cache->context_table)
+ silc_hash_table_free(cache->context_table);
+ silc_free(cache);
+ return NULL;
+ }
+
return cache;
}
/* Allocate new cache entry */
c = silc_calloc(1, sizeof(*c));
+ if (!c)
+ return FALSE;
c->id = id;
c->name = name;
c->expire = expire;
return TRUE;
list = silc_idcache_list_alloc();
+ if (!list)
+ return FALSE;
silc_hash_table_foreach(cache->id_table, silc_idcache_get_all_foreach, list);
if (silc_idcache_list_count(list) == 0) {
SilcIDCacheList list;
list = silc_idcache_list_alloc();
+ if (!list)
+ return FALSE;
if (!ret)
return TRUE;
SilcIDCacheList list;
list = silc_idcache_list_alloc();
+ if (!list)
+ return FALSE;
if (!ret)
return TRUE;
SilcIDCacheList list;
list = silc_calloc(1, sizeof(*list));
+ if (!list)
+ return FALSE;
return list;
}
i = list->cache_dyn_count;
list->cache_dyn = silc_realloc(list->cache_dyn,
sizeof(*list->cache_dyn) * (i + 5));
+ if (!list->cache_dyn)
+ return;
/* NULL the reallocated area */
for (k = i; k < (i + 5); k++)