diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-03-30 13:31:44 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-03-30 16:33:03 -0500 |
commit | 5f73c2ef0a3e483e3d7faddcc4a7baf876fc3258 (patch) | |
tree | 4af550e6abecbbd05652c15fc82b21240c9515ff /res | |
parent | e1fdb0a6da0287452837c25b1295baa30b5866ed (diff) |
res_stasis.c: Protect channel datastore list from stasis end.
Change-Id: Ifadc469590bd4d5368e19d3763db3bd1f80fdb95
Diffstat (limited to 'res')
-rw-r--r-- | res/res_stasis.c | 12 |
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 */ |