diff options
author | Joshua Colp <jcolp@digium.com> | 2016-03-31 07:05:24 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-03-31 07:05:24 -0500 |
commit | 7372925a5b72313074cb9c248753fc83161ce9ca (patch) | |
tree | d5f072ddb0abe47ea35b2ebf3fb4482d3959a754 | |
parent | 99c749cf26d66c915ba6cf2f1f643963dcc1e757 (diff) | |
parent | 2fab4d7da82cd4799b8d1ba65dfa467255d9f6c5 (diff) |
Merge "res_stasis.c: Protect channel datastore list from stasis end."
-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 */ |