[Asterisk-code-review] res stasis.c: Protect channel datastore list from stasis end. (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Wed Mar 30 16:33:43 CDT 2016


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/2506

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/06/2506/1

diff --git a/res/res_stasis.c b/res/res_stasis.c
index 94b037e..629955e 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/2506
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifadc469590bd4d5368e19d3763db3bd1f80fdb95
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list