aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-28 18:41:18 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-28 18:41:18 +0000
commit2a92caf3221235c0977b4f395c489d258d33995b (patch)
tree47fb475a7e6ae8f70f0cfdd703461483f0b1e926 /pbx
parentac52aa8cd647b169554fb09012f69be9b6bd249d (diff)
Add proper channel locking around the uses of datastore_add and _find. There
are still more places in the tree that I have not yet changed if someone wants to go through and find the places they are used without the channel locked. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@81262 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_dundi.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index e165104cc..169426c4c 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -3934,7 +3934,9 @@ static int dundi_query_read(struct ast_channel *chan, const char *cmd, char *dat
if (drds->num_results > 0)
sort_results(drds->results, drds->num_results);
+ ast_channel_lock(chan);
ast_channel_datastore_add(chan, datastore);
+ ast_channel_unlock(chan);
ast_module_user_remove(u);
@@ -3991,11 +3993,16 @@ static int dundi_result_read(struct ast_channel *chan, const char *cmd, char *da
ast_log(LOG_ERROR, "A result number must be given to DUNDIRESULT!\n");
goto finish;
}
+
+ ast_channel_lock(chan);
+ datastore = ast_channel_datastore_find(chan, &dundi_result_datastore_info, args.id);
+ ast_channel_unlock(chan);
- if (!(datastore = ast_channel_datastore_find(chan, &dundi_result_datastore_info, args.id))) {
+ if (!datastore) {
ast_log(LOG_WARNING, "No DUNDi results found for query ID '%s'\n", args.id);
goto finish;
}
+
drds = datastore->data;
if (!strcasecmp(args.resultnum, "getnum")) {