From d9b7ce0599998dd911bc0184d0b7817a8ea9f273 Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Wed, 18 Dec 2013 11:59:49 +0000
Subject: [PATCH] res_calendar: Protect channel when adding datastore.

This change adds a missing channel lock when adding a datastore
to a channel.
........

Merged revisions 404135 from http://svn.asterisk.org/svn/asterisk/branches/1.8


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@404136 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 res/res_calendar.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/res/res_calendar.c b/res/res_calendar.c
index b60d8234d9..0ec032cf99 100644
--- a/res/res_calendar.c
+++ b/res/res_calendar.c
@@ -766,7 +766,10 @@ static void *do_notify(void *data)
 	datastore->inheritance = DATASTORE_INHERIT_FOREVER;
 
 	ao2_ref(event, +1);
+
+	ast_channel_lock(chan);
 	res = ast_channel_datastore_add(chan, datastore);
+	ast_channel_unlock(chan);
 
 	if (!(tmpstr = ast_str_create(32))) {
 		goto notify_cleanup;
-- 
GitLab