aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-21 08:13:12 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-21 08:13:12 +0000
commit3f2c7248c603bebb962be9879a320eca1f147a53 (patch)
tree368912509e968ce6178e8e9586490a3e9edbac0e /apps
parent7d766728281dd1b6eb53a4ec8d0e8e5d6312835c (diff)
remove lots of useless checks of the result of ast_strdupa
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8379 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_authenticate.c5
-rw-r--r--apps/app_chanspy.c5
-rw-r--r--apps/app_curl.c5
-rw-r--r--apps/app_db.c10
-rw-r--r--apps/app_dial.c11
-rw-r--r--apps/app_dictate.c4
-rw-r--r--apps/app_directory.c6
-rw-r--r--apps/app_disa.c5
-rw-r--r--apps/app_exec.c33
-rw-r--r--apps/app_externalivr.c5
-rw-r--r--apps/app_festival.c6
-rw-r--r--apps/app_hasnewvoicemail.c10
-rw-r--r--apps/app_image.c6
-rw-r--r--apps/app_macro.c5
-rw-r--r--apps/app_meetme.c9
-rw-r--r--apps/app_mixmonitor.c6
-rw-r--r--apps/app_osplookup.c15
-rw-r--r--apps/app_page.c5
-rw-r--r--apps/app_playback.c4
-rw-r--r--apps/app_privacy.c5
-rw-r--r--apps/app_queue.c18
-rw-r--r--apps/app_random.c5
-rw-r--r--apps/app_read.c5
-rw-r--r--apps/app_readfile.c5
-rw-r--r--apps/app_realtime.c38
-rw-r--r--apps/app_record.c5
-rw-r--r--apps/app_sayunixtime.c29
-rw-r--r--apps/app_senddtmf.c5
-rw-r--r--apps/app_sendtext.c8
-rw-r--r--apps/app_setcallerid.c5
-rw-r--r--apps/app_skel.c5
-rw-r--r--apps/app_stack.c4
-rw-r--r--apps/app_talkdetect.c5
-rw-r--r--apps/app_transfer.c11
-rw-r--r--apps/app_url.c8
-rw-r--r--apps/app_userevent.c5
-rw-r--r--apps/app_verbose.c57
-rw-r--r--apps/app_voicemail.c83
-rw-r--r--apps/app_while.c10
-rw-r--r--apps/app_zapras.c5
40 files changed, 111 insertions, 365 deletions
diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c
index b7678a002..462506152 100644
--- a/apps/app_authenticate.c
+++ b/apps/app_authenticate.c
@@ -129,11 +129,6 @@ static int auth_exec(struct ast_channel *chan, void *data)
}
argcopy = ast_strdupa(data);
- if (!argcopy) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(arglist,argcopy);
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 5d49e1268..7d5c4adc3 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -383,10 +383,7 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
struct ast_flags flags;
signed char zero_volume = 0;
- if (!(args = ast_strdupa((char *)data))) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- return -1;
- }
+ args = ast_strdupa(data);
LOCAL_USER_ADD(u);
diff --git a/apps/app_curl.c b/apps/app_curl.c
index 93d77d571..9842da4cd 100644
--- a/apps/app_curl.c
+++ b/apps/app_curl.c
@@ -129,11 +129,6 @@ static char *acf_curl_exec(struct ast_channel *chan, char *cmd, char *data, char
LOCAL_USER_ACF_ADD(u);
info = ast_strdupa(data);
- if (!info) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return buf;
- }
AST_STANDARD_APP_ARGS(args, info);
diff --git a/apps/app_db.c b/apps/app_db.c
index 76a52cd1b..0161d4aa9 100644
--- a/apps/app_db.c
+++ b/apps/app_db.c
@@ -76,11 +76,6 @@ static int deltree_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
argv = ast_strdupa(data);
- if (!argv) {
- ast_log(LOG_ERROR, "Memory allocation failed\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
if (strchr(argv, '/')) {
family = strsep(&argv, "/");
@@ -122,11 +117,6 @@ static int del_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
argv = ast_strdupa(data);
- if (!argv) {
- ast_log (LOG_ERROR, "Memory allocation failed\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
if (strchr(argv, '/')) {
family = strsep(&argv, "/");
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 3d45cf577..21e234294 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -786,11 +786,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory allocation failure\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -1628,11 +1624,6 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
announce = ast_strdupa(data);
- if (!announce) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
memset(&peerflags, 0, sizeof(peerflags));
diff --git a/apps/app_dictate.c b/apps/app_dictate.c
index 3935c81ac..29f27d94e 100644
--- a/apps/app_dictate.c
+++ b/apps/app_dictate.c
@@ -111,10 +111,6 @@ static int dictate_exec(struct ast_channel *chan, void *data)
snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
if (!ast_strlen_zero(data)) {
parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- return -1;
- }
AST_STANDARD_APP_ARGS(args, parse);
} else
args.argc = 0;
diff --git a/apps/app_directory.c b/apps/app_directory.c
index d506df1f1..4a4a6f59e 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -433,12 +433,6 @@ static int directory_exec(struct ast_channel *chan, void *data)
parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
AST_STANDARD_APP_ARGS(args, parse);
if (args.options) {
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 3ba92e8a2..3c78b9b6a 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -162,11 +162,6 @@ static int disa_exec(struct ast_channel *chan, void *data)
ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
tmp = ast_strdupa(data);
- if (!tmp) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(args, tmp);
diff --git a/apps/app_exec.c b/apps/app_exec.c
index 9759455ac..b2a45dc93 100644
--- a/apps/app_exec.c
+++ b/apps/app_exec.c
@@ -73,27 +73,22 @@ static int exec_exec(struct ast_channel *chan, void *data)
/* Check and parse arguments */
if (data) {
- s = ast_strdupa((char *)data);
+ s = ast_strdupa(data);
+ appname = strsep(&s, "(");
if (s) {
- appname = strsep(&s, "(");
- if (s) {
- endargs = strrchr(s, ')');
- if (endargs)
- *endargs = '\0';
- pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
- }
- if (appname) {
- app = pbx_findapp(appname);
- if (app) {
- res = pbx_exec(chan, app, args, 1);
- } else {
- ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
- res = -1;
- }
+ endargs = strrchr(s, ')');
+ if (endargs)
+ *endargs = '\0';
+ pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+ }
+ if (appname) {
+ app = pbx_findapp(appname);
+ if (app) {
+ res = pbx_exec(chan, app, args, 1);
+ } else {
+ ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+ res = -1;
}
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
- res = -1;
}
}
diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c
index 10232044d..bcf65d362 100644
--- a/apps/app_externalivr.c
+++ b/apps/app_externalivr.c
@@ -272,11 +272,6 @@ static int app_exec(struct ast_channel *chan, void *data)
}
buf = ast_strdupa(data);
- if (!buf) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0]));
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 1921fdd11..4ef0f0163 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -340,12 +340,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
}
data = ast_strdupa(vdata);
- if (!data) {
- ast_log(LOG_ERROR, "Out of memery\n");
- ast_config_destroy(cfg);
- LOCAL_USER_REMOVE(u);
- return -1;
- }
intstr = strchr(data, '|');
if (intstr) {
diff --git a/apps/app_hasnewvoicemail.c b/apps/app_hasnewvoicemail.c
index bb5535190..f4696fcbb 100644
--- a/apps/app_hasnewvoicemail.c
+++ b/apps/app_hasnewvoicemail.c
@@ -130,11 +130,6 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
input = ast_strdupa((char *)data);
- if (! input) {
- ast_log(LOG_ERROR, "Out of memory error\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(args, input);
@@ -194,11 +189,6 @@ static char *acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *data, c
buf[0] = '\0';
argsstr = ast_strdupa(data);
- if (!argsstr) {
- ast_log(LOG_ERROR, "Out of memory");
- LOCAL_USER_REMOVE(u);
- return buf;
- }
AST_STANDARD_APP_ARGS(args, argsstr);
diff --git a/apps/app_image.c b/apps/app_image.c
index d33465aa9..689c19363 100644
--- a/apps/app_image.c
+++ b/apps/app_image.c
@@ -78,11 +78,7 @@ static int sendimage_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 63cf46474..a33e9f2ed 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -308,11 +308,6 @@ static int macroif_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
expr = ast_strdupa(data);
- if (!expr) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
if ((label_a = strchr(expr, '?'))) {
*label_a = '\0';
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index c3068ce3c..3ce629874 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -1779,10 +1779,6 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
continue;
parse = ast_strdupa(var->value);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
- return NULL;
- }
AST_STANDARD_APP_ARGS(args, parse);
if (!strcasecmp(args.confno, confno)) {
@@ -1839,11 +1835,6 @@ static int count_exec(struct ast_channel *chan, void *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;
- }
AST_STANDARD_APP_ARGS(args, localdata);
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index 279f0e646..0b1f68e67 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -333,11 +333,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c
index af9bf9877..18091e5c5 100644
--- a/apps/app_osplookup.c
+++ b/apps/app_osplookup.c
@@ -139,11 +139,6 @@ static int osplookup_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
temp = ast_strdupa(data);
- if (!temp) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(args, temp);
@@ -202,11 +197,6 @@ static int ospnext_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
temp = ast_strdupa(data);
- if (!temp) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(args, temp);
@@ -276,11 +266,6 @@ static int ospfinished_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
temp = ast_strdupa(data);
- if (!temp) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(args, temp);
diff --git a/apps/app_page.c b/apps/app_page.c
index 4dd9f2015..b4eb1a55b 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -164,11 +164,6 @@ static int page_exec(struct ast_channel *chan, void *data)
};
options = ast_strdupa(data);
- if (!options) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
tmp = strsep(&options, "|");
if (options)
diff --git a/apps/app_playback.c b/apps/app_playback.c
index 653d95467..7df06d91b 100644
--- a/apps/app_playback.c
+++ b/apps/app_playback.c
@@ -90,10 +90,6 @@ static int playback_exec(struct ast_channel *chan, void *data)
}
tmp = ast_strdupa(data);
- if (!tmp) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- return -1;
- }
LOCAL_USER_ADD(u);
AST_STANDARD_APP_ARGS(args, tmp);
diff --git a/apps/app_privacy.c b/apps/app_privacy.c
index a3d26af33..3a0561b62 100644
--- a/apps/app_privacy.c
+++ b/apps/app_privacy.c
@@ -118,11 +118,6 @@ static int privacy_exec (struct ast_channel *chan, void *data)
if (!ast_strlen_zero((char *)data))
{
parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(args, parse);
diff --git a/apps/app_queue.c b/apps/app_queue.c
index d48d163e4..e0acccce3 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2645,11 +2645,7 @@ static int pqm_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -2701,11 +2697,7 @@ static int upqm_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -2759,11 +2751,7 @@ static int rqm_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
diff --git a/apps/app_random.c b/apps/app_random.c
index f7d09e87a..2ebd437a2 100644
--- a/apps/app_random.c
+++ b/apps/app_random.c
@@ -74,11 +74,6 @@ static int random_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
s = ast_strdupa(data);
- if (!s) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
prob = strsep(&s,":");
if ((!prob) || (sscanf(prob, "%d", &probint) != 1))
diff --git a/apps/app_read.c b/apps/app_read.c
index ef7f183ad..eaa9cfdd2 100644
--- a/apps/app_read.c
+++ b/apps/app_read.c
@@ -118,11 +118,6 @@ static int read_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
argcopy = ast_strdupa(data);
- if (!argcopy) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(arglist, argcopy);
diff --git a/apps/app_readfile.c b/apps/app_readfile.c
index 528fe8237..33935486b 100644
--- a/apps/app_readfile.c
+++ b/apps/app_readfile.c
@@ -74,11 +74,6 @@ static int readfile_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
s = ast_strdupa(data);
- if (!s) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
varname = strsep(&s, "=");
file = strsep(&s, "|");
diff --git a/apps/app_realtime.c b/apps/app_realtime.c
index 9e83d2638..a88620ea6 100644
--- a/apps/app_realtime.c
+++ b/apps/app_realtime.c
@@ -148,20 +148,19 @@ static int realtime_update_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if ((family = ast_strdupa(data))) {
- if ((colmatch = strchr(family,'|'))) {
- crop_data(colmatch);
- if ((value = strchr(colmatch,'|'))) {
- crop_data(value);
- if ((newcol = strchr(value,'|'))) {
- crop_data(newcol);
- if ((newval = strchr(newcol,'|')))
- crop_data(newval);
- }
+ family = ast_strdupa(data);
+ if ((colmatch = strchr(family,'|'))) {
+ crop_data(colmatch);
+ if ((value = strchr(colmatch,'|'))) {
+ crop_data(value);
+ if ((newcol = strchr(value,'|'))) {
+ crop_data(newcol);
+ if ((newval = strchr(newcol,'|')))
+ crop_data(newval);
}
}
}
- if (! (family && value && colmatch && newcol && newval) ) {
+ if (!newval) {
ast_log(LOG_ERROR,"Invalid input: usage %s\n",UUSAGE);
res = -1;
} else {
@@ -193,17 +192,16 @@ static int realtime_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if ((family = ast_strdupa(data))) {
- if ((colmatch = strchr(family,'|'))) {
- crop_data(colmatch);
- if ((value = strchr(colmatch,'|'))) {
- crop_data(value);
- if ((prefix = strchr(value,'|')))
- crop_data(prefix);
- }
+ family = ast_strdupa(data);
+ if ((colmatch = strchr(family,'|'))) {
+ crop_data(colmatch);
+ if ((value = strchr(colmatch,'|'))) {
+ crop_data(value);
+ if ((prefix = strchr(value,'|')))
+ crop_data(prefix);
}
}
- if (! (family && value && colmatch) ) {
+ if (!value) {
ast_log(LOG_ERROR,"Invalid input: usage %s\n",USAGE);
res = -1;
} else {
diff --git a/apps/app_record.c b/apps/app_record.c
index f5be5528d..c4f28fcab 100644
--- a/apps/app_record.c
+++ b/apps/app_record.c
@@ -117,11 +117,6 @@ static int record_exec(struct ast_channel *chan, void *data)
/* Yay for strsep being easy */
vdata = ast_strdupa(data);
- if (!vdata) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
p = vdata;
filename = strsep(&p, "|");
diff --git a/apps/app_sayunixtime.c b/apps/app_sayunixtime.c
index cde4e65c9..4739d9796 100644
--- a/apps/app_sayunixtime.c
+++ b/apps/app_sayunixtime.c
@@ -92,26 +92,21 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data)
}
if (data) {
- s = data;
- s = ast_strdupa(s);
- if (s) {
- timec = strsep(&s,"|");
- if ((timec) && (*timec != '\0')) {
- long timein;
- if (sscanf(timec,"%ld",&timein) == 1) {
- unixtime = (time_t)timein;
- }
+ s = ast_strdupa(data);
+ timec = strsep(&s,"|");
+ if ((timec) && (*timec != '\0')) {
+ long timein;
+ if (sscanf(timec,"%ld",&timein) == 1) {
+ unixtime = (time_t)timein;
}
+ }
+ if (s) {
+ zone = strsep(&s,"|");
+ if (zone && (*zone == '\0'))
+ zone = NULL;
if (s) {
- zone = strsep(&s,"|");
- if (zone && (*zone == '\0'))
- zone = NULL;
- if (s) {
- format = s;
- }
+ format = s;
}
- } else {
- ast_log(LOG_ERROR, "Out of memory error\n");
}
}
diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c
index e4eb33ecf..fe1af90f6 100644
--- a/apps/app_senddtmf.c
+++ b/apps/app_senddtmf.c
@@ -75,11 +75,6 @@ static int senddtmf_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
digits = ast_strdupa(data);
- if (!digits) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
if ((to = strchr(digits,'|'))) {
*to = '\0';
diff --git a/apps/app_sendtext.c b/apps/app_sendtext.c
index 4ddbc1c65..4f39fa4dd 100644
--- a/apps/app_sendtext.c
+++ b/apps/app_sendtext.c
@@ -87,14 +87,8 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n");
LOCAL_USER_REMOVE(u);
return -1;
- } else {
+ } else
parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
- }
AST_STANDARD_APP_ARGS(args, parse);
diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c
index 7c643b281..5e857c4ab 100644
--- a/apps/app_setcallerid.c
+++ b/apps/app_setcallerid.c
@@ -118,11 +118,6 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
tmp = ast_strdupa(data);
- if (!tmp) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
opt = strchr(tmp, '|');
if (opt) {
diff --git a/apps/app_skel.c b/apps/app_skel.c
index b29f3162a..ba2999a1c 100644
--- a/apps/app_skel.c
+++ b/apps/app_skel.c
@@ -88,11 +88,6 @@ static int app_exec(struct ast_channel *chan, void *data)
/* We need to make a copy of the input string if we are going to modify it! */
args = ast_strdupa(data);
- if (!args) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
dummy = argv[0];
diff --git a/apps/app_stack.c b/apps/app_stack.c
index db2eafa85..8323f0b23 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -130,10 +130,6 @@ static int gosubif_exec(struct ast_channel *chan, void *data)
}
args = ast_strdupa((char *)data);
- if (!args) {
- ast_log(LOG_ERROR, "Out of memory\n");
- return -1;
- }
LOCAL_USER_ADD(u);
diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c
index 2223e85b6..89a69e784 100644
--- a/apps/app_talkdetect.c
+++ b/apps/app_talkdetect.c
@@ -89,11 +89,6 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
tmp = ast_strdupa(data);
- if (!tmp) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
stringp=tmp;
strsep(&stringp, "|");
diff --git a/apps/app_transfer.c b/apps/app_transfer.c
index 98790341e..c97d97dcd 100644
--- a/apps/app_transfer.c
+++ b/apps/app_transfer.c
@@ -88,19 +88,14 @@ static int transfer_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if (ast_strlen_zero((char *)data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[|options])\n");
LOCAL_USER_REMOVE(u);
pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
return 0;
- } else {
- parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
}
+
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
diff --git a/apps/app_url.c b/apps/app_url.c
index 7791b4e54..10bd1fad2 100644
--- a/apps/app_url.c
+++ b/apps/app_url.c
@@ -94,14 +94,8 @@ static int sendurl_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- tmp = ast_strdupa(data);
- if (!tmp) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ stringp = tmp = ast_strdupa(data);
- stringp=tmp;
strsep(&stringp, "|");
options = strsep(&stringp, "|");
if (options && !strcasecmp(options, "wait"))
diff --git a/apps/app_userevent.c b/apps/app_userevent.c
index 95f5fbc84..850627fad 100644
--- a/apps/app_userevent.c
+++ b/apps/app_userevent.c
@@ -75,11 +75,6 @@ static int userevent_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
info = ast_strdupa(data);
- if (!info) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
snprintf(eventname, sizeof(eventname), "UserEvent%s", info);
eventbody = strchr(eventname, '|');
diff --git a/apps/app_verbose.c b/apps/app_verbose.c
index 4ec4839d7..4b7a54b0e 100644
--- a/apps/app_verbose.c
+++ b/apps/app_verbose.c
@@ -67,38 +67,34 @@ static int verbose_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
if (data) {
- vtext = ast_strdupa((char *)data);
+ vtext = ast_strdupa(data);
+ char *tmp = strsep(&vtext, "|,");
if (vtext) {
- char *tmp = strsep(&vtext, "|,");
- if (vtext) {
- if (sscanf(tmp, "%d", &vsize) != 1) {
- vsize = 0;
- ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
- }
- } else {
- vtext = tmp;
+ if (sscanf(tmp, "%d", &vsize) != 1) {
vsize = 0;
- }
- if (option_verbose >= vsize) {
- switch (vsize) {
- case 0:
- ast_verbose("%s\n", vtext);
- break;
- case 1:
- ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
- break;
- case 2:
- ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
- break;
- case 3:
- ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
- break;
- default:
- ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
- }
+ ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
}
} else {
- ast_log(LOG_ERROR, "Out of memory\n");
+ vtext = tmp;
+ vsize = 0;
+ }
+ if (option_verbose >= vsize) {
+ switch (vsize) {
+ case 0:
+ ast_verbose("%s\n", vtext);
+ break;
+ case 1:
+ ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
+ break;
+ case 2:
+ ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
+ break;
+ case 3:
+ ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
+ break;
+ default:
+ ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
+ }
}
}
@@ -121,11 +117,6 @@ static int log_exec(struct ast_channel *chan, void *data)
}
ltext = ast_strdupa(data);
- if (!ltext) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
level = strsep(&ltext, "|");
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index e46735d03..bf6e93a8f 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3284,28 +3284,23 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
/* Attach only the first format */
- fmt = ast_strdupa(fmt);
- if (fmt) {
- stringp = fmt;
- strsep(&stringp, "|");
-
- if (!ast_strlen_zero(vmu->email)) {
- int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
- char *myserveremail = serveremail;
- attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
- if (!ast_strlen_zero(vmu->serveremail))
- myserveremail = vmu->serveremail;
- sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
- }
-
- if (!ast_strlen_zero(vmu->pager)) {
- char *myserveremail = serveremail;
- if (!ast_strlen_zero(vmu->serveremail))
- myserveremail = vmu->serveremail;
- sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
- }
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
+ stringp = fmt = ast_strdupa(fmt);
+ strsep(&stringp, "|");
+
+ if (!ast_strlen_zero(vmu->email)) {
+ int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
+ char *myserveremail = serveremail;
+ attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
+ if (!ast_strlen_zero(vmu->serveremail))
+ myserveremail = vmu->serveremail;
+ sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
+ }
+
+ if (!ast_strlen_zero(vmu->pager)) {
+ char *myserveremail = serveremail;
+ if (!ast_strlen_zero(vmu->serveremail))
+ myserveremail = vmu->serveremail;
+ sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
}
if (ast_test_flag(vmu, VM_DELETE)) {
@@ -5058,11 +5053,6 @@ static int vm_execmain(struct ast_channel *chan, void *data)
);
parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(args, parse);
@@ -5648,11 +5638,6 @@ static int vm_box_exists(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
box = ast_strdupa(data);
- if (!box) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
AST_STANDARD_APP_ARGS(args, box);
@@ -5690,10 +5675,6 @@ static int vmauthenticate(struct ast_channel *chan, void *data)
if (s) {
s = ast_strdupa(s);
- if (!s) {
- ast_log(LOG_ERROR, "Out of memory\n");
- return -1;
- }
user = strsep(&s, "|");
options = strsep(&s, "|");
if (user) {
@@ -6140,28 +6121,22 @@ static int load_config(void)
if ((z = ast_malloc(sizeof(*z)))) {
char *msg_format, *timezone;
msg_format = ast_strdupa(var->value);
- if (msg_format != NULL) {
- timezone = strsep(&msg_format, "|");
- if (msg_format) {
- ast_copy_string(z->name, var->name, sizeof(z->name));
- ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
- ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
- z->next = NULL;
- if (zones) {
- zonesl->next = z;
- zonesl = z;
- } else {
- zones = z;
- zonesl = z;
- }
+ timezone = strsep(&msg_format, "|");
+ if (msg_format) {
+ ast_copy_string(z->name, var->name, sizeof(z->name));
+ ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
+ ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
+ z->next = NULL;
+ if (zones) {
+ zonesl->next = z;
+ zonesl = z;
} else {
- ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
- free(z);
+ zones = z;
+ zonesl = z;
}
} else {
- ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
+ ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
free(z);
- return -1;
}
} else {
return -1;
diff --git a/apps/app_while.c b/apps/app_while.c
index 1ebd8f2b3..df2fb97e6 100644
--- a/apps/app_while.c
+++ b/apps/app_while.c
@@ -90,11 +90,6 @@ static int execif_exec(struct ast_channel *chan, void *data) {
LOCAL_USER_ADD(u);
expr = ast_strdupa(data);
- if (!expr) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
if ((myapp = strchr(expr,'|'))) {
*myapp = '\0';
@@ -244,9 +239,8 @@ static int _while_exec(struct ast_channel *chan, void *data, int end)
snprintf(used_index, VAR_SIZE, "%d", used_index_i);
snprintf(new_index, VAR_SIZE, "%d", used_index_i + 1);
- if (!end) {
- condition = ast_strdupa((char *) data);
- }
+ if (!end)
+ condition = ast_strdupa(data);
size = strlen(chan->context) + strlen(chan->exten) + 32;
my_name = alloca(size);
diff --git a/apps/app_zapras.c b/apps/app_zapras.c
index 94285cb45..9b69c391f 100644
--- a/apps/app_zapras.c
+++ b/apps/app_zapras.c
@@ -210,11 +210,6 @@ static int zapras_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
args = ast_strdupa(data);
- if (!args) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
/* Answer the channel if it's not up */
if (chan->_state != AST_STATE_UP)