summaryrefslogtreecommitdiff
path: root/main/stasis_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/stasis_cache.c')
-rw-r--r--main/stasis_cache.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/main/stasis_cache.c b/main/stasis_cache.c
index 8b4304e5f..c492307d6 100644
--- a/main/stasis_cache.c
+++ b/main/stasis_cache.c
@@ -185,10 +185,13 @@ static struct stasis_cache_entry *cache_entry_create(struct stasis_message_type
struct stasis_cache_entry *entry;
int is_remote;
- ast_assert(type != NULL);
ast_assert(id != NULL);
ast_assert(snapshot != NULL);
+ if (!type) {
+ return NULL;
+ }
+
entry = ao2_alloc_options(sizeof(*entry), cache_entry_dtor,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!entry) {
@@ -550,9 +553,12 @@ struct ao2_container *stasis_cache_get_all(struct stasis_cache *cache, struct st
ast_assert(cache != NULL);
ast_assert(cache->entries != NULL);
- ast_assert(type != NULL);
ast_assert(id != NULL);
+ if (!type) {
+ return NULL;
+ }
+
found = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, NULL, NULL);
if (!found) {
return NULL;
@@ -619,9 +625,12 @@ struct stasis_message *stasis_cache_get_by_eid(struct stasis_cache *cache, struc
ast_assert(cache != NULL);
ast_assert(cache->entries != NULL);
- ast_assert(type != NULL);
ast_assert(id != NULL);
+ if (!type) {
+ return NULL;
+ }
+
ao2_rdlock(cache->entries);
cached_entry = cache_find(cache->entries, type, id);
@@ -752,6 +761,10 @@ static struct stasis_message *update_create(struct stasis_message *old_snapshot,
ast_assert(old_snapshot != NULL || new_snapshot != NULL);
+ if (!stasis_cache_update_type()) {
+ return NULL;
+ }
+
update = ao2_alloc_options(sizeof(*update), stasis_cache_update_dtor,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!update) {