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:56 -0500 |
commit | 2fab4d7da82cd4799b8d1ba65dfa467255d9f6c5 (patch) | |
tree | b56b597562ef9f1e0d616f78c4904e713494e301 | |
parent | 23d2a561d55bc226414dc839544138d77b49adfa (diff) |
res_stasis.c: Protect channel datastore list from stasis end.
Change-Id: Ifadc469590bd4d5368e19d3763db3bd1f80fdb95
-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 63c565d44..b26cfdd1f 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 */ |