aboutsummaryrefslogtreecommitdiffstats
path: root/addons
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-06 19:25:35 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-06 19:25:35 +0000
commit1f776a7d277e306b154b440becc66de5bf3193ba (patch)
tree3ed1206de31132417132748fce959b88ce454c4e /addons
parent48cc3e3e33c4b9a1a86d346457b3f450e7b2338b (diff)
Merged revisions 317837 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r317837 | russell | 2011-05-06 14:24:11 -0500 (Fri, 06 May 2011) | 11 lines Fix a crash in the MySQL() application. This code was not handling channel datastores safely. The channel must be locked. (closes issue #17964) Reported by: wuwu Patches: issue17964_addon_1.6.2_svn.patch uploaded by seanbright (license 71) Tested by: wuwu ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@317843 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'addons')
-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);