summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-03-31 00:48:38 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-03-31 00:48:38 -0500
commit6be8b89b2f910c25dc37844c6c7f17824c49dd4c (patch)
treefbc47549273983dc871eb8c60ea6beb043e154cb
parent74d63f56eedf02523b3ddbe9c46efa183df77428 (diff)
parent5f73c2ef0a3e483e3d7faddcc4a7baf876fc3258 (diff)
Merge "res_stasis.c: Protect channel datastore list from stasis end." into 13
-rw-r--r--res/res_stasis.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/res/res_stasis.c b/res/res_stasis.c
index 94b037e69..629955ed9 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1188,10 +1188,11 @@ void stasis_app_channel_set_stasis_end_published(struct ast_channel *chan)
struct ast_datastore *datastore;
datastore = ast_datastore_alloc(&set_end_published_info, NULL);
-
- ast_channel_lock(chan);
- ast_channel_datastore_add(chan, datastore);
- ast_channel_unlock(chan);
+ if (datastore) {
+ ast_channel_lock(chan);
+ ast_channel_datastore_add(chan, datastore);
+ ast_channel_unlock(chan);
+ }
}
int stasis_app_channel_is_stasis_end_published(struct ast_channel *chan)
@@ -1211,12 +1212,11 @@ static void remove_stasis_end_published(struct ast_channel *chan)
ast_channel_lock(chan);
datastore = ast_channel_datastore_find(chan, &set_end_published_info, NULL);
- ast_channel_unlock(chan);
-
if (datastore) {
ast_channel_datastore_remove(chan, datastore);
ast_datastore_free(datastore);
}
+ ast_channel_unlock(chan);
}
/*! /brief Stasis dialplan application callback */