From: Richard Mudgett Date: Wed, 30 Mar 2016 18:31:44 +0000 (-0500) Subject: res_stasis.c: Protect channel datastore list from stasis end. X-Git-Tag: 13.9.0-rc1~60^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f73c2ef0a3e483e3d7faddcc4a7baf876fc3258;p=thirdparty%2Fasterisk.git res_stasis.c: Protect channel datastore list from stasis end. Change-Id: Ifadc469590bd4d5368e19d3763db3bd1f80fdb95 --- diff --git a/res/res_stasis.c b/res/res_stasis.c index 94b037e69c..629955ed9e 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 */