on this pass, only remove duplicate log messages

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8403 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Russell Bryant 20 years ago
parent 41c87ccb97
commit 4414f45393

@ -128,9 +128,7 @@ static int auth_exec(struct ast_channel *chan, void *data)
} }
} }
argcopy = ast_strdupa(data); if (!(argcopy = ast_strdupa(data))) {
if (!argcopy) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -383,10 +383,8 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
struct ast_flags flags; struct ast_flags flags;
signed char zero_volume = 0; signed char zero_volume = 0;
if (!(args = ast_strdupa((char *)data))) { if (!(args = ast_strdupa(data)))
ast_log(LOG_ERROR, "Out of memory!\n");
return -1; return -1;
}
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);

@ -128,9 +128,7 @@ static char *acf_curl_exec(struct ast_channel *chan, char *cmd, char *data, char
LOCAL_USER_ACF_ADD(u); LOCAL_USER_ACF_ADD(u);
info = ast_strdupa(data); if (!(info = ast_strdupa(data))) {
if (!info) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return buf; return buf;
} }

@ -75,9 +75,7 @@ static int deltree_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
argv = ast_strdupa(data); if (!(argv = ast_strdupa(data))) {
if (!argv) {
ast_log(LOG_ERROR, "Memory allocation failed\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return 0; return 0;
} }
@ -121,9 +119,7 @@ static int del_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
argv = ast_strdupa(data); if (!(argv = ast_strdupa(data))) {
if (!argv) {
ast_log (LOG_ERROR, "Memory allocation failed\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return 0; return 0;
} }

@ -787,7 +787,6 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) { if (!(parse = ast_strdupa(data))) {
ast_log(LOG_WARNING, "Memory allocation failure\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -1627,9 +1626,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
announce = ast_strdupa(data); if (!(announce = ast_strdupa(data))) {
if (!announce) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -110,11 +110,8 @@ static int dictate_exec(struct ast_channel *chan, void *data)
snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR); snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
if (!ast_strlen_zero(data)) { if (!ast_strlen_zero(data)) {
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
return -1; return -1;
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);
} else } else
args.argc = 0; args.argc = 0;

@ -431,10 +431,7 @@ static int directory_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data))) {
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -161,9 +161,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
ast_log(LOG_DEBUG, "Digittimeout: %d\n", digittimeout); ast_log(LOG_DEBUG, "Digittimeout: %d\n", digittimeout);
ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout); ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
tmp = ast_strdupa(data); if (!(tmp = ast_strdupa(data))) {
if (!tmp) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -73,8 +73,7 @@ static int exec_exec(struct ast_channel *chan, void *data)
/* Check and parse arguments */ /* Check and parse arguments */
if (data) { if (data) {
s = ast_strdupa((char *)data); if ((s = ast_strdupa(data))) {
if (s) {
appname = strsep(&s, "("); appname = strsep(&s, "(");
if (s) { if (s) {
endargs = strrchr(s, ')'); endargs = strrchr(s, ')');
@ -91,10 +90,8 @@ static int exec_exec(struct ast_channel *chan, void *data)
res = -1; res = -1;
} }
} }
} else { } else
ast_log(LOG_ERROR, "Out of memory\n");
res = -1; res = -1;
}
} }
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);

@ -271,9 +271,7 @@ static int app_exec(struct ast_channel *chan, void *data)
goto exit; goto exit;
} }
buf = ast_strdupa(data); if (!(buf = ast_strdupa(data))) {
if (!buf) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -339,9 +339,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n"; festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
} }
data = ast_strdupa(vdata); if (!(data = ast_strdupa(vdata))) {
if (!data) {
ast_log(LOG_ERROR, "Out of memery\n");
ast_config_destroy(cfg); ast_config_destroy(cfg);
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;

@ -129,9 +129,7 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
input = ast_strdupa((char *)data); if (!(input = ast_strdupa(data))) {
if (! input) {
ast_log(LOG_ERROR, "Out of memory error\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -193,9 +191,7 @@ static char *acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *data, c
buf[0] = '\0'; buf[0] = '\0';
argsstr = ast_strdupa(data); if (!(argsstr = ast_strdupa(data))) {
if (!argsstr) {
ast_log(LOG_ERROR, "Out of memory");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return buf; return buf;
} }

@ -79,7 +79,6 @@ static int sendimage_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) { if (!(parse = ast_strdupa(data))) {
ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -307,9 +307,7 @@ static int macroif_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
expr = ast_strdupa(data); if (!(expr = ast_strdupa(data))) {
if (!expr) {
ast_log(LOG_ERROR, "Out of Memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -1778,11 +1778,8 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
if (strcasecmp(var->name, "conf")) if (strcasecmp(var->name, "conf"))
continue; continue;
parse = ast_strdupa(var->value); if (!(parse = ast_strdupa(var->value)))
if (!parse) {
ast_log(LOG_ERROR, "Out of Memory!\n");
return NULL; return NULL;
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);
if (!strcasecmp(args.confno, confno)) { if (!strcasecmp(args.confno, confno)) {
@ -1838,9 +1835,7 @@ static int count_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
localdata = ast_strdupa(data); if (!(localdata = ast_strdupa(data))) {
if (!localdata) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -1987,8 +1982,6 @@ static int conf_exec(struct ast_channel *chan, void *data)
} }
} }
} }
} else {
ast_log(LOG_ERROR, "Out of memory\n");
} }
} }
var = var->next; var = var->next;

@ -334,7 +334,6 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) { if (!(parse = ast_strdupa(data))) {
ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -138,9 +138,7 @@ static int osplookup_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
temp = ast_strdupa(data); if (!(temp = ast_strdupa(data))) {
if (!temp) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -201,9 +199,7 @@ static int ospnext_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
temp = ast_strdupa(data); if (!(temp = ast_strdupa(data))) {
if (!temp) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -275,9 +271,7 @@ static int ospfinished_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
temp = ast_strdupa(data); if (!(temp = ast_strdupa(data))) {
if (!temp) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -163,9 +163,7 @@ static int page_exec(struct ast_channel *chan, void *data)
return -1; return -1;
}; };
options = ast_strdupa(data); if (!(options = ast_strdupa(data))) {
if (!options) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -89,11 +89,8 @@ static int playback_exec(struct ast_channel *chan, void *data)
return -1; return -1;
} }
tmp = ast_strdupa(data); if (!(tmp = ast_strdupa(data)))
if (!tmp) {
ast_log(LOG_ERROR, "Out of memory!\n");
return -1; return -1;
}
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
AST_STANDARD_APP_ARGS(args, tmp); AST_STANDARD_APP_ARGS(args, tmp);

@ -117,9 +117,7 @@ static int privacy_exec (struct ast_channel *chan, void *data)
if (!ast_strlen_zero((char *)data)) if (!ast_strlen_zero((char *)data))
{ {
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data))) {
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -2671,7 +2671,6 @@ static int pqm_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) { if (!(parse = ast_strdupa(data))) {
ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -2727,7 +2726,6 @@ static int upqm_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) { if (!(parse = ast_strdupa(data))) {
ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -2785,7 +2783,6 @@ static int rqm_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) { if (!(parse = ast_strdupa(data))) {
ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -73,9 +73,7 @@ static int random_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
s = ast_strdupa(data); if (!(s = ast_strdupa(data))) {
if (!s) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -117,9 +117,7 @@ static int read_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
argcopy = ast_strdupa(data); if (!(argcopy = ast_strdupa(data))) {
if (!argcopy) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -73,9 +73,7 @@ static int readfile_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
s = ast_strdupa(data); if (!(s = ast_strdupa(data))) {
if (!s) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -116,9 +116,7 @@ static int record_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
/* Yay for strsep being easy */ /* Yay for strsep being easy */
vdata = ast_strdupa(data); if (!(vdata = ast_strdupa(data))) {
if (!vdata) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -93,8 +93,7 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data)
if (data) { if (data) {
s = data; s = data;
s = ast_strdupa(s); if ((s = ast_strdupa(s))) {
if (s) {
timec = strsep(&s,"|"); timec = strsep(&s,"|");
if ((timec) && (*timec != '\0')) { if ((timec) && (*timec != '\0')) {
long timein; long timein;
@ -110,8 +109,6 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data)
format = s; format = s;
} }
} }
} else {
ast_log(LOG_ERROR, "Out of memory error\n");
} }
} }

@ -74,9 +74,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
digits = ast_strdupa(data); if (!(digits = ast_strdupa(data))) {
if (!digits) {
ast_log(LOG_ERROR, "Out of Memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -88,9 +88,7 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} else { } else {
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data))) {
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -117,9 +117,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
tmp = ast_strdupa(data); if (!(tmp = ast_strdupa(data))) {
if (!tmp) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -87,9 +87,7 @@ static int app_exec(struct ast_channel *chan, void *data)
/* Do our thing here */ /* Do our thing here */
/* We need to make a copy of the input string if we are going to modify it! */ /* We need to make a copy of the input string if we are going to modify it! */
args = ast_strdupa(data); if (!(args = ast_strdupa(data))) {
if (!args) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -129,11 +129,8 @@ static int gosubif_exec(struct ast_channel *chan, void *data)
return 0; return 0;
} }
args = ast_strdupa((char *)data); if (!(args = ast_strdupa(data)))
if (!args) {
ast_log(LOG_ERROR, "Out of memory\n");
return -1; return -1;
}
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);

@ -88,9 +88,7 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
tmp = ast_strdupa(data); if (!(tmp = ast_strdupa(data))) {
if (!tmp) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -94,9 +94,7 @@ static int transfer_exec(struct ast_channel *chan, void *data)
pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
return 0; return 0;
} else { } else {
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data))) {
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -94,9 +94,7 @@ static int sendurl_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
tmp = ast_strdupa(data); if (!(tmp = ast_strdupa(data))) {
if (!tmp) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -74,9 +74,7 @@ static int userevent_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
info = ast_strdupa(data); if (!(info = ast_strdupa(data))) {
if (!info) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -67,8 +67,7 @@ static int verbose_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (data) { if (data) {
vtext = ast_strdupa((char *)data); if ((vtext = ast_strdupa(data))) {
if (vtext) {
char *tmp = strsep(&vtext, "|,"); char *tmp = strsep(&vtext, "|,");
if (vtext) { if (vtext) {
if (sscanf(tmp, "%d", &vsize) != 1) { if (sscanf(tmp, "%d", &vsize) != 1) {
@ -97,8 +96,6 @@ static int verbose_exec(struct ast_channel *chan, void *data)
ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext); ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
} }
} }
} else {
ast_log(LOG_ERROR, "Out of memory\n");
} }
} }
@ -120,9 +117,7 @@ static int log_exec(struct ast_channel *chan, void *data)
return 0; return 0;
} }
ltext = ast_strdupa(data); if (!(ltext = ast_strdupa(data))) {
if (!ltext) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return 0; return 0;
} }

@ -3284,8 +3284,7 @@ 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); snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
/* Attach only the first format */ /* Attach only the first format */
fmt = ast_strdupa(fmt); if ((fmt = ast_strdupa(fmt))) {
if (fmt) {
stringp = fmt; stringp = fmt;
strsep(&stringp, "|"); strsep(&stringp, "|");
@ -3304,8 +3303,6 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
myserveremail = vmu->serveremail; myserveremail = vmu->serveremail;
sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category); sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
} }
} else {
ast_log(LOG_ERROR, "Out of memory\n");
} }
if (ast_test_flag(vmu, VM_DELETE)) { if (ast_test_flag(vmu, VM_DELETE)) {
@ -5057,9 +5054,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
AST_APP_ARG(argv1); AST_APP_ARG(argv1);
); );
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data))) {
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -5647,9 +5642,7 @@ static int vm_box_exists(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
box = ast_strdupa(data); if (!(box = ast_strdupa(data))) {
if (!box) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -5689,11 +5682,8 @@ static int vmauthenticate(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (s) { if (s) {
s = ast_strdupa(s); if (!(s = ast_strdupa(s)))
if (!s) {
ast_log(LOG_ERROR, "Out of memory\n");
return -1; return -1;
}
user = strsep(&s, "|"); user = strsep(&s, "|");
options = strsep(&s, "|"); options = strsep(&s, "|");
if (user) { if (user) {
@ -6139,8 +6129,7 @@ static int load_config(void)
struct vm_zone *z; struct vm_zone *z;
if ((z = ast_malloc(sizeof(*z)))) { if ((z = ast_malloc(sizeof(*z)))) {
char *msg_format, *timezone; char *msg_format, *timezone;
msg_format = ast_strdupa(var->value); if ((msg_format = ast_strdupa(var->value))) {
if (msg_format != NULL) {
timezone = strsep(&msg_format, "|"); timezone = strsep(&msg_format, "|");
if (msg_format) { if (msg_format) {
ast_copy_string(z->name, var->name, sizeof(z->name)); ast_copy_string(z->name, var->name, sizeof(z->name));
@ -6159,7 +6148,6 @@ static int load_config(void)
free(z); free(z);
} }
} else { } else {
ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
free(z); free(z);
return -1; return -1;
} }

@ -89,9 +89,7 @@ static int execif_exec(struct ast_channel *chan, void *data) {
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
expr = ast_strdupa(data); if (!(expr = ast_strdupa(data))) {
if (!expr) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -209,9 +209,7 @@ static int zapras_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
args = ast_strdupa(data); if (!(args = ast_strdupa(data))) {
if (!args) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }

@ -3705,12 +3705,9 @@ ast_group_t ast_get_group(char *s)
int start=0, finish=0, x; int start=0, finish=0, x;
ast_group_t group = 0; ast_group_t group = 0;
copy = ast_strdupa(s); c = copy = ast_strdupa(s);
if (!copy) { if (!copy)
ast_log(LOG_ERROR, "Out of memory\n");
return 0; return 0;
}
c = copy;
while ((piece = strsep(&c, ","))) { while ((piece = strsep(&c, ","))) {
if (sscanf(piece, "%d-%d", &start, &finish) == 2) { if (sscanf(piece, "%d-%d", &start, &finish) == 2) {

@ -328,11 +328,8 @@ static struct agent_pvt *add_agent(char *agent, int pending)
char *agt = NULL; char *agt = NULL;
struct agent_pvt *p, *prev; struct agent_pvt *p, *prev;
parse = ast_strdupa(agent); if (!(parse = ast_strdupa(agent)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
return NULL; return NULL;
}
/* Extract username (agt), password and name from agent (args). */ /* Extract username (agt), password and name from agent (args). */
AST_NONSTANDARD_APP_ARGS(args, parse, ','); AST_NONSTANDARD_APP_ARGS(args, parse, ',');
@ -1768,7 +1765,6 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) { if (!(parse = ast_strdupa(data))) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return -1; return -1;
} }
@ -2510,11 +2506,8 @@ static char *function_agent(struct ast_channel *chan, char *cmd, char *data, cha
return buf; return buf;
} }
item = ast_strdupa(data); if (!(item = ast_strdupa(data)))
if (!item) {
ast_log(LOG_ERROR, "Out of memory!\n");
return buf; return buf;
}
agentid = strsep(&item, ":"); agentid = strsep(&item, ":");
if (!item) if (!item)

@ -8033,11 +8033,8 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr)
char *addr; char *addr;
char *portstr; char *portstr;
tmp = ast_strdupa(srcaddr); if (!(tmp = ast_strdupa(srcaddr)))
if (!tmp) {
ast_log(LOG_WARNING, "Out of memory!\n");
return -1; return -1;
}
addr = strsep(&tmp, ":"); addr = strsep(&tmp, ":");
portstr = tmp; portstr = tmp;
@ -9174,10 +9171,8 @@ static char *function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, c
char *peername, *colname; char *peername, *colname;
char iabuf[INET_ADDRSTRLEN]; char iabuf[INET_ADDRSTRLEN];
if (!(peername = ast_strdupa(data))) { if (!(peername = ast_strdupa(data)))
ast_log(LOG_ERROR, "Memory Error!\n");
return ret; return ret;
}
/* if our channel, return the IP address of the endpoint of current channel */ /* if our channel, return the IP address of the endpoint of current channel */
if (!strcmp(peername,"CURRENTCHANNEL")) { if (!strcmp(peername,"CURRENTCHANNEL")) {

@ -9292,10 +9292,8 @@ static char *function_sippeer(struct ast_channel *chan, char *cmd, char *data, c
char *peername, *colname; char *peername, *colname;
char iabuf[INET_ADDRSTRLEN]; char iabuf[INET_ADDRSTRLEN];
if (!(peername = ast_strdupa(data))) { if (!(peername = ast_strdupa(data)))
ast_log(LOG_ERROR, "Memory Error!\n");
return ret; return ret;
}
if ((colname = strchr(peername, ':'))) { if ((colname = strchr(peername, ':'))) {
*colname = '\0'; *colname = '\0';
@ -12847,11 +12845,9 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
char *extension, *host, *port; char *extension, *host, *port;
char tmp[80]; char tmp[80];
cdest = ast_strdupa(dest); if (!(cdest = ast_strdupa(dest)))
if (!cdest) {
ast_log(LOG_ERROR, "Problem allocating the memory\n");
return 0; return 0;
}
extension = strsep(&cdest, "@"); extension = strsep(&cdest, "@");
host = strsep(&cdest, ":"); host = strsep(&cdest, ":");
port = strsep(&cdest, ":"); port = strsep(&cdest, ":");
@ -12879,17 +12875,11 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
ast_log(LOG_ERROR, "Can't find the host address\n"); ast_log(LOG_ERROR, "Can't find the host address\n");
return 0; return 0;
} }
host = ast_strdupa(lhost); if (!(host = ast_strdupa(lhost)))
if (!host) {
ast_log(LOG_ERROR, "Problem allocating the memory\n");
return 0; return 0;
}
if (!ast_strlen_zero(lport)) { if (!ast_strlen_zero(lport)) {
port = ast_strdupa(lport); if (!(port = ast_strdupa(lport)))
if (!port) {
ast_log(LOG_ERROR, "Problem allocating the memory\n");
return 0; return 0;
}
} }
} }
} }

@ -63,11 +63,8 @@ static char *builtin_function_cdr_read(struct ast_channel *chan, char *cmd, char
if (!chan->cdr) if (!chan->cdr)
return NULL; return NULL;
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
return NULL; return NULL;
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);
@ -92,11 +89,8 @@ static void builtin_function_cdr_write(struct ast_channel *chan, char *cmd, char
if (ast_strlen_zero(data) || !value) if (ast_strlen_zero(data) || !value)
return; return;
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
return; return;
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);

@ -83,10 +83,8 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz
return ERROR_NOARG; return ERROR_NOARG;
} }
strings = ast_strdupa((char *)data); if (!(strings = ast_strdupa(data)))
if (!strings) {
return ERROR_NOMEM; return ERROR_NOMEM;
}
for (ptrkey = strings; *ptrkey; ptrkey++) { for (ptrkey = strings; *ptrkey; ptrkey++) {
if (*ptrkey == '|') { if (*ptrkey == '|') {
@ -142,11 +140,8 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size
memset(buffer, 0, buflen); memset(buffer, 0, buflen);
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
return ERROR_NOMEM; return ERROR_NOMEM;
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);

@ -55,10 +55,8 @@ static char *builtin_function_iftime(struct ast_channel *chan, char *cmd, char *
char *iftrue; char *iftrue;
char *iffalse; char *iffalse;
if (!(data = ast_strdupa(data))) { if (!(data = ast_strdupa(data)))
ast_log(LOG_WARNING, "Memory Error!\n");
return NULL; return NULL;
}
data = ast_strip_quoted(data, "\"", "\""); data = ast_strip_quoted(data, "\"", "\"");
expr = strsep(&data, "?"); expr = strsep(&data, "?");
@ -95,10 +93,8 @@ static char *builtin_function_if(struct ast_channel *chan, char *cmd, char *data
char *iftrue; char *iftrue;
char *iffalse; char *iffalse;
if (!(data = ast_strdupa(data))) { if (!(data = ast_strdupa(data)))
ast_log(LOG_WARNING, "Memory Error!\n");
return NULL; return NULL;
}
data = ast_strip_quoted(data, "\"", "\""); data = ast_strip_quoted(data, "\"", "\"");
expr = strsep(&data, "?"); expr = strsep(&data, "?");
@ -129,10 +125,8 @@ static char *builtin_function_set(struct ast_channel *chan, char *cmd, char *dat
char *varname; char *varname;
char *val; char *val;
if (!(data = ast_strdupa(data))) { if (!(data = ast_strdupa(data)))
ast_log(LOG_WARNING, "Memory Error!\n");
return NULL; return NULL;
}
varname = strsep(&data, "="); varname = strsep(&data, "=");
val = data; val = data;

@ -88,11 +88,8 @@ static char *builtin_function_math(struct ast_channel *chan, char *cmd, char *da
return NULL; return NULL;
} }
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if(!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
return NULL; return NULL;
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);

@ -67,11 +67,8 @@ static char *builtin_function_checkmd5(struct ast_channel *chan, char *cmd, char
return NULL; return NULL;
} }
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
return NULL; return NULL;
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);

@ -265,9 +265,7 @@ static char *acf_odbc_read(struct ast_channel *chan, char *cmd, char *data, char
#endif #endif
/* Parse our arguments */ /* Parse our arguments */
s = ast_strdupa(data); if (!(s = ast_strdupa(data))) {
if (!s) {
ast_log(LOG_ERROR, "Out of memory\n");
ast_mutex_unlock(&query_lock); ast_mutex_unlock(&query_lock);
return ""; return "";
} }

@ -56,7 +56,6 @@ static char *acf_rand_exec(struct ast_channel *chan, char *cmd, char *data, char
LOCAL_USER_ACF_ADD(u); LOCAL_USER_ACF_ADD(u);
if (!(s = ast_strdupa(data))) { if (!(s = ast_strdupa(data))) {
ast_log(LOG_WARNING, "Out of memory\n");
*buffer = '\0'; *buffer = '\0';
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return buffer; return buffer;

@ -51,9 +51,7 @@ static char *function_fieldqty(struct ast_channel *chan, char *cmd, char *data,
AST_APP_ARG(delim); AST_APP_ARG(delim);
); );
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data))) {
if (!parse) {
ast_log(LOG_ERROR, "Out of memory\n");
ast_copy_string(buf, "0", len); ast_copy_string(buf, "0", len);
return buf; return buf;
} }
@ -90,11 +88,8 @@ static char *builtin_function_filter(struct ast_channel *chan, char *cmd, char *
); );
char *outbuf=buf; char *outbuf=buf;
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory");
return ""; return "";
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);
@ -140,11 +135,8 @@ static char *builtin_function_regex(struct ast_channel *chan, char *cmd, char *d
ast_copy_string(buf, "0", len); ast_copy_string(buf, "0", len);
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory in %s(%s)\n", cmd, data);
return buf; return buf;
}
AST_NONSTANDARD_APP_ARGS(args, parse, '"'); AST_NONSTANDARD_APP_ARGS(args, parse, '"');
@ -185,10 +177,8 @@ static void builtin_function_array(struct ast_channel *chan, char *cmd, char *da
var = ast_strdupa(data); var = ast_strdupa(data);
value2 = ast_strdupa(value); value2 = ast_strdupa(value);
if (!var || !value2) { if (!var || !value2)
ast_log(LOG_ERROR, "Out of memory\n");
return; return;
}
/* The functions this will generally be used with are SORT and ODBC_*, which /* The functions this will generally be used with are SORT and ODBC_*, which
* both return comma-delimited lists. However, if somebody uses literal lists, * both return comma-delimited lists. However, if somebody uses literal lists,
@ -276,11 +266,8 @@ static char *acf_strftime(struct ast_channel *chan, char *cmd, char *data, char
return buf; return buf;
} }
parse = ast_strdupa(data); if (!(parse = ast_strdupa(data)))
if (!parse) {
ast_log(LOG_ERROR, "Out of memory\n");
return buf; return buf;
}
AST_STANDARD_APP_ARGS(args, parse); AST_STANDARD_APP_ARGS(args, parse);

25
pbx.c

@ -1219,11 +1219,8 @@ char *ast_func_read(struct ast_channel *chan, const char *in, char *workspace, s
char *ret = "0"; char *ret = "0";
struct ast_custom_function *acfptr; struct ast_custom_function *acfptr;
function = ast_strdupa(in); if (!(function = ast_strdupa(in)))
if (!function) {
ast_log(LOG_ERROR, "Out of memory\n");
return ret; return ret;
}
if ((args = strchr(function, '('))) { if ((args = strchr(function, '('))) {
*args = '\0'; *args = '\0';
args++; args++;
@ -1254,11 +1251,8 @@ void ast_func_write(struct ast_channel *chan, const char *in, const char *value)
char *args = NULL, *function, *p; char *args = NULL, *function, *p;
struct ast_custom_function *acfptr; struct ast_custom_function *acfptr;
function = ast_strdupa(in); if (!(function = ast_strdupa(in)))
if (!function) {
ast_log(LOG_ERROR, "Out of memory\n");
return; return;
}
if ((args = strchr(function, '('))) { if ((args = strchr(function, '('))) {
*args = '\0'; *args = '\0';
args++; args++;
@ -5145,11 +5139,8 @@ static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data)
struct ast_flags flags = { 0 }; struct ast_flags flags = { 0 };
if (!ast_strlen_zero(data)) { if (!ast_strlen_zero(data)) {
args = ast_strdupa(data); if (!(args = ast_strdupa(data)))
if (!args) {
ast_log(LOG_ERROR, "Out of memory!\n");
return -1; return -1;
}
ast_app_parse_options(resetcdr_opts, &flags, NULL, args); ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
} }
@ -5205,8 +5196,6 @@ static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data)
/* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */
if (ast_build_timing(&timing, s) && ast_check_timing(&timing)) if (ast_build_timing(&timing, s) && ast_check_timing(&timing))
res = pbx_builtin_goto(chan, (void *)ts); res = pbx_builtin_goto(chan, (void *)ts);
} else {
ast_log(LOG_ERROR, "Memory Error!\n");
} }
return res; return res;
} }
@ -5227,12 +5216,8 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data)
return -1; return -1;
} }
ptr1 = ast_strdupa(data); if (!(ptr1 = ast_strdupa(data)))
return -1;
if (!ptr1) {
ast_log(LOG_ERROR, "Out of Memory!\n");
return -1;
}
ptr2 = ptr1; ptr2 = ptr1;
/* Separate the Application data ptr1 is the time spec ptr2 is the app|data */ /* Separate the Application data ptr1 is the time spec ptr2 is the app|data */

Loading…
Cancel
Save