[asterisk-commits] res stasis.c: Protect channel datastore list from stasis end. (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 31 07:05:24 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: res_stasis.c: Protect channel datastore list from stasis end.
......................................................................


res_stasis.c: Protect channel datastore list from stasis end.

Change-Id: Ifadc469590bd4d5368e19d3763db3bd1f80fdb95
---
M res/res_stasis.c
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, approved; Verified
  George Joseph: Looks good to me, but someone else must approve



diff --git a/res/res_stasis.c b/res/res_stasis.c
index 63c565d..b26cfdd 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1188,10 +1188,11 @@
 	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 @@
 
 	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 */

-- 
To view, visit https://gerrit.asterisk.org/2507
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifadc469590bd4d5368e19d3763db3bd1f80fdb95
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list