aboutsummaryrefslogtreecommitdiffstats
path: root/addons/app_mysql.c
diff options
context:
space:
mode:
Diffstat (limited to 'addons/app_mysql.c')
-rw-r--r--addons/app_mysql.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/app_mysql.c b/addons/app_mysql.c
index b65b5bb93..589b23823 100644
--- a/addons/app_mysql.c
+++ b/addons/app_mysql.c
@@ -546,7 +546,10 @@ static int MYSQL_exec(struct ast_channel *chan, const char *data)
result = 0;
if (autoclear) {
- struct ast_datastore *mysql_store = ast_channel_datastore_find(chan, &mysql_ds_info, NULL);
+ struct ast_datastore *mysql_store = NULL;
+
+ ast_channel_lock(chan);
+ mysql_store = ast_channel_datastore_find(chan, &mysql_ds_info, NULL);
if (!mysql_store) {
if (!(mysql_store = ast_datastore_alloc(&mysql_ds_info, NULL))) {
ast_log(LOG_WARNING, "Unable to allocate new datastore.\n");
@@ -555,6 +558,7 @@ static int MYSQL_exec(struct ast_channel *chan, const char *data)
ast_channel_datastore_add(chan, mysql_store);
}
}
+ ast_channel_unlock(chan);
}
ast_mutex_lock(&_mysql_mutex);