aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_meetme.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-19 18:19:02 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-19 18:19:02 +0000
commit58818426d60d583c4becc6a99b398cbac1b7b12f (patch)
tree5fee3540f8d72d45cd1b2e5bf15e5860581dd4f8 /apps/app_meetme.c
parenta4d6ea67a7536e2cb2337527357ce6d3db8639f3 (diff)
Massive cleanups to applications for LOCAL_USER handling and some other things.
In general, LOCAL_USER_ADD/REMOVE should be the first/last thing called in an application. An exception is if there is some *fast* setup code that might halt the execution of the application, such as checking to see if an argument exists. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6832 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_meetme.c')
-rwxr-xr-xapps/app_meetme.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index aa3e6153e..4a1edc698 100755
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -1667,8 +1667,16 @@ static int count_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "MeetMeCount requires an argument (conference number)\n");
return -1;
}
- localdata = ast_strdupa(data);
+
LOCAL_USER_ADD(u);
+
+ localdata = ast_strdupa(data);
+ if (!localdata) {
+ ast_log(LOG_ERROR, "Out of memory!\n");
+ LOCAL_USER_REMOVE(u);
+ return -1;
+ }
+
confnum = strsep(&localdata,"|");
conf = find_conf(chan, confnum, 0, 0, NULL);
if (conf)
@@ -1704,17 +1712,19 @@ static int conf_exec(struct ast_channel *chan, void *data)
int always_prompt = 0;
char *notdata, *info, *inflags = NULL, *inpin = NULL, the_pin[AST_MAX_EXTENSION] = "";
+ LOCAL_USER_ADD(u);
+
if (!data || ast_strlen_zero(data)) {
allowretry = 1;
notdata = "";
} else {
notdata = data;
}
- LOCAL_USER_ADD(u);
+
if (chan->_state != AST_STATE_UP)
ast_answer(chan);
- info = ast_strdupa((char *)notdata);
+ info = ast_strdupa(notdata);
if (info) {
char *tmp = strsep(&info, "|");
@@ -1956,6 +1966,9 @@ static int admin_exec(struct ast_channel *chan, void *data) {
char *params, *command = NULL, *caller = NULL, *conf = NULL;
struct ast_conference *cnf;
struct ast_conf_user *user = NULL;
+ struct localuser *u;
+
+ LOCAL_USER_ADD(u);
ast_mutex_lock(&conflock);
/* The param has the conference number the user and the command to execute */
@@ -1968,6 +1981,7 @@ static int admin_exec(struct ast_channel *chan, void *data) {
if (!command) {
ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n");
ast_mutex_unlock(&conflock);
+ LOCAL_USER_REMOVE(u);
return -1;
}
cnf = confs;
@@ -2059,6 +2073,9 @@ static int admin_exec(struct ast_channel *chan, void *data) {
}
}
ast_mutex_unlock(&conflock);
+
+ LOCAL_USER_REMOVE(u);
+
return 0;
}