diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index b7678a002156eb47ebf154c6ae4457f9ee05e1f1..3dd27fe1139fdff0a495f036f4d0bc1791586197 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -128,9 +128,7 @@ static int auth_exec(struct ast_channel *chan, void *data) } } - argcopy = ast_strdupa(data); - if (!argcopy) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(argcopy = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 5d49e12684b4be3915416c47fe79fdca6ea02272..1d828d59babe44dfecc052ac514943f4a8b92481 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -383,10 +383,8 @@ 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"); + if (!(args = ast_strdupa(data))) return -1; - } LOCAL_USER_ADD(u); diff --git a/apps/app_curl.c b/apps/app_curl.c index 93d77d571723dfb13a9855f0c1508bdab08467c3..c1736969b86bf7b5e309ecbc115576e45828f7ae 100644 --- a/apps/app_curl.c +++ b/apps/app_curl.c @@ -128,9 +128,7 @@ 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"); + if (!(info = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return buf; } diff --git a/apps/app_db.c b/apps/app_db.c index 76a52cd1bc08d37d42b2e4446ae038c302621e8e..3eafca591f0beddc49d6e483c33187cc42ebc892 100644 --- a/apps/app_db.c +++ b/apps/app_db.c @@ -75,9 +75,7 @@ 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"); + if (!(argv = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return 0; } @@ -121,9 +119,7 @@ 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"); + if (!(argv = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return 0; } diff --git a/apps/app_dial.c b/apps/app_dial.c index 3d45cf577caa38886795d57f1f6a686e3363f1e1..25fa9cfc598b488fdf5a0d2b682090e92e74c9ef 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -787,7 +787,6 @@ 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; } @@ -1627,9 +1626,7 @@ 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"); + if (!(announce = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_dictate.c b/apps/app_dictate.c index 3935c81ac301d156581639d62b07a36de44cdfee..20fec3c98161d5e15ca93926d159dcb8db84878f 100644 --- a/apps/app_dictate.c +++ b/apps/app_dictate.c @@ -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); if (!ast_strlen_zero(data)) { - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) 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 d506df1f12c099838ca6b05e83ecec612dd4d383..d3225018795ac7ee7036d16694d13fa710bfba72 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -431,10 +431,7 @@ static int directory_exec(struct ast_channel *chan, void *data) LOCAL_USER_ADD(u); - parse = ast_strdupa(data); - - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_disa.c b/apps/app_disa.c index 3ba92e8a2811b0f8706b96e3467808c59bca959f..cbaae05a569eea6c798cd9e539cca54a941df605 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -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, "Responsetimeout: %d\n", firstdigittimeout); - tmp = ast_strdupa(data); - if (!tmp) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(tmp = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_exec.c b/apps/app_exec.c index 9759455aca3db0b6ce0404ab929465289698d0ce..9f8390d5c20231d1194b82cfeb6a2d8ca60fc7f7 100644 --- a/apps/app_exec.c +++ b/apps/app_exec.c @@ -73,8 +73,7 @@ static int exec_exec(struct ast_channel *chan, void *data) /* Check and parse arguments */ if (data) { - s = ast_strdupa((char *)data); - if (s) { + if ((s = ast_strdupa(data))) { appname = strsep(&s, "("); if (s) { endargs = strrchr(s, ')'); @@ -91,10 +90,8 @@ static int exec_exec(struct ast_channel *chan, void *data) res = -1; } } - } else { - ast_log(LOG_ERROR, "Out of memory\n"); + } else res = -1; - } } LOCAL_USER_REMOVE(u); diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index 10232044d74ad9e51a5e4f19c59647364d94d4b5..37359c690304dc4351144761e6c06c4fb2386079 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -271,9 +271,7 @@ static int app_exec(struct ast_channel *chan, void *data) goto exit; } - buf = ast_strdupa(data); - if (!buf) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(buf = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_festival.c b/apps/app_festival.c index 1921fdd11207141cecf3b775e3864f221415758f..e00fce61823cac862492fa4a5666a41068f5b573 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -339,9 +339,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata) festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n"; } - data = ast_strdupa(vdata); - if (!data) { - ast_log(LOG_ERROR, "Out of memery\n"); + if (!(data = ast_strdupa(vdata))) { ast_config_destroy(cfg); LOCAL_USER_REMOVE(u); return -1; diff --git a/apps/app_hasnewvoicemail.c b/apps/app_hasnewvoicemail.c index bb553519026f10657aea27c79b83ec1f7d137859..f2350ebcd40a6e61312ad7eb867650155d62fd09 100644 --- a/apps/app_hasnewvoicemail.c +++ b/apps/app_hasnewvoicemail.c @@ -129,9 +129,7 @@ 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"); + if (!(input = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } @@ -193,9 +191,7 @@ 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"); + if (!(argsstr = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return buf; } diff --git a/apps/app_image.c b/apps/app_image.c index d33465aa9f4d56318d7ae9967958f56355daec71..75cb346530cb01f8d075184d159c68a41287503f 100644 --- a/apps/app_image.c +++ b/apps/app_image.c @@ -79,7 +79,6 @@ 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; } diff --git a/apps/app_macro.c b/apps/app_macro.c index 63cf464747d5b4011ebf758a21d65f2990efb646..a011dc65d3cb7694f2679cc76d7ee185c511a6b3 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -307,9 +307,7 @@ 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"); + if (!(expr = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_meetme.c b/apps/app_meetme.c index c3068ce3cb56576399c5fb944dcb738dd4bc011c..b3291f52a9a1887eab7a408df846f94ad5c080c1 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -1778,11 +1778,8 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, if (strcasecmp(var->name, "conf")) continue; - parse = ast_strdupa(var->value); - if (!parse) { - ast_log(LOG_ERROR, "Out of Memory!\n"); + if (!(parse = ast_strdupa(var->value))) return NULL; - } AST_STANDARD_APP_ARGS(args, parse); if (!strcasecmp(args.confno, confno)) { @@ -1838,9 +1835,7 @@ 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"); + if (!(localdata = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); 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; diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 279f0e646067abeb1fd8437d5c07b219d11c4c60..acc882502872efddb79f6e6bd4b2c39fa695836f 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -334,7 +334,6 @@ 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; } diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index af9bf9877fb746834c8cc4f552b89c53534cf90f..e94a15ef5489ca9cc3af5ebc9173a0f1a77b979e 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -138,9 +138,7 @@ 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"); + if (!(temp = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } @@ -201,9 +199,7 @@ 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"); + if (!(temp = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } @@ -275,9 +271,7 @@ 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"); + if (!(temp = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_page.c b/apps/app_page.c index 4dd9f20154f20a401a931401bcd58de2a48cae76..44e603519cc0da951296d4d5c75a7f1da4fdc94d 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -163,9 +163,7 @@ static int page_exec(struct ast_channel *chan, void *data) return -1; }; - options = ast_strdupa(data); - if (!options) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(options = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_playback.c b/apps/app_playback.c index 653d9546736c02af30dfcebc4ec39648150fce34..2023308ba97568b5114af1570eb4b81b78535530 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -89,11 +89,8 @@ static int playback_exec(struct ast_channel *chan, void *data) return -1; } - tmp = ast_strdupa(data); - if (!tmp) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(tmp = ast_strdupa(data))) 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 a3d26af336e98a5bcf4213275fa976ec19fafcb9..2503b82f39fb7986b047d3e68502acb463f5754e 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -117,9 +117,7 @@ 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"); + if (!(parse = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_queue.c b/apps/app_queue.c index c09ac3b26f0c116dd48011ba4b606276dbf941b0..582059b1baf619463e85409eee0f212395a5363a 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -2671,7 +2671,6 @@ 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; } @@ -2727,7 +2726,6 @@ 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; } @@ -2785,7 +2783,6 @@ 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; } diff --git a/apps/app_random.c b/apps/app_random.c index f7d09e87a6675c2591f1d20a02413c6fbcc776d7..b533166af955d9bc13dcd7025058242f12303d5c 100644 --- a/apps/app_random.c +++ b/apps/app_random.c @@ -73,9 +73,7 @@ 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"); + if (!(s = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_read.c b/apps/app_read.c index ef7f183ad28a82fadcdfc00ee661836fbdbfcd1d..461ad995eca04c9e10b22b558bad10242ba32ede 100644 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -117,9 +117,7 @@ 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"); + if (!(argcopy = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_readfile.c b/apps/app_readfile.c index 528fe823773dd2b65ff544ee699ab5d2424af0c6..f842663ee7fda57a68e65342ccb7b58152f4efc1 100644 --- a/apps/app_readfile.c +++ b/apps/app_readfile.c @@ -73,9 +73,7 @@ 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"); + if (!(s = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_record.c b/apps/app_record.c index f5be5528de6efed0c52f6ca281aa0beaeab944eb..f594947bdd2525099ecd4e03b25d7ca70656d5fb 100644 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -116,9 +116,7 @@ static int record_exec(struct ast_channel *chan, void *data) LOCAL_USER_ADD(u); /* Yay for strsep being easy */ - vdata = ast_strdupa(data); - if (!vdata) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(vdata = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_sayunixtime.c b/apps/app_sayunixtime.c index cde4e65c9cae467cfdd81f40b90cfdf27c52a32c..c6db4f14044260af3827db66b16542b1afc761e2 100644 --- a/apps/app_sayunixtime.c +++ b/apps/app_sayunixtime.c @@ -93,8 +93,7 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data) if (data) { s = data; - s = ast_strdupa(s); - if (s) { + if ((s = ast_strdupa(s))) { timec = strsep(&s,"|"); if ((timec) && (*timec != '\0')) { long timein; @@ -110,8 +109,6 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data) 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 e4eb33ecf0204ae94064067f21bb77c441173cf2..b019c96019ea69f1fef997e55f7bc8c7a7314a2a 100644 --- a/apps/app_senddtmf.c +++ b/apps/app_senddtmf.c @@ -74,9 +74,7 @@ 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"); + if (!(digits = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_sendtext.c b/apps/app_sendtext.c index 4ddbc1c65c61f3b0ebfa2b884598378222a77be4..fea5ebaf94983badc88e2ce03ae4c25cbf9b7ef0 100644 --- a/apps/app_sendtext.c +++ b/apps/app_sendtext.c @@ -88,9 +88,7 @@ static int sendtext_exec(struct ast_channel *chan, void *data) LOCAL_USER_REMOVE(u); return -1; } else { - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c index 7c643b2817bd88624d51bc3f3594b996aac7acae..b3a70c4f5ec642e84405a19db8114d99d87238bf 100644 --- a/apps/app_setcallerid.c +++ b/apps/app_setcallerid.c @@ -117,9 +117,7 @@ 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"); + if (!(tmp = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_skel.c b/apps/app_skel.c index b29f3162a0f6fb7ba47b4eb62fa0edf6c2f8e96b..27c9a7a5013ffb33ae1cef3598001d37b37b9712 100644 --- a/apps/app_skel.c +++ b/apps/app_skel.c @@ -87,9 +87,7 @@ static int app_exec(struct ast_channel *chan, void *data) /* Do our thing here */ /* 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"); + if (!(args = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_stack.c b/apps/app_stack.c index db2eafa85ab206962c87afe1b38813412d823584..60aa22f0355abb9d07938f462313f57b5315d215 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -129,11 +129,8 @@ static int gosubif_exec(struct ast_channel *chan, void *data) return 0; } - args = ast_strdupa((char *)data); - if (!args) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(args = ast_strdupa(data))) return -1; - } LOCAL_USER_ADD(u); diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 2223e85b6d2857d112cc3d3a88c575327c894fde..cd1e680493f658a49fe917a97b6b348658aa8c0e 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -88,9 +88,7 @@ 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"); + if (!(tmp = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_transfer.c b/apps/app_transfer.c index 98790341eaec9e8514cc59f06d5ba8fb723ea1c1..41c6e35ddceb291e58dc055438e24cfcd72661ad 100644 --- a/apps/app_transfer.c +++ b/apps/app_transfer.c @@ -94,9 +94,7 @@ static int transfer_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); return 0; } else { - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_url.c b/apps/app_url.c index 7791b4e549010dd789e1a9f9546622eca330e782..2b8dccff980794b0619e381f92bd8f4a4467f448 100644 --- a/apps/app_url.c +++ b/apps/app_url.c @@ -94,9 +94,7 @@ 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"); + if (!(tmp = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_userevent.c b/apps/app_userevent.c index 95f5fbc840533c52ada4128c46261400b7d53807..a62c50b8891f1f4fdaaf3badc3868f02dc81b9e3 100644 --- a/apps/app_userevent.c +++ b/apps/app_userevent.c @@ -74,9 +74,7 @@ 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"); + if (!(info = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_verbose.c b/apps/app_verbose.c index 4ec4839d7adfb5d95e30f66ec333f10f18ac8349..72504c6fa565d5c5d1c39d2153f226b10a38411e 100644 --- a/apps/app_verbose.c +++ b/apps/app_verbose.c @@ -67,8 +67,7 @@ static int verbose_exec(struct ast_channel *chan, void *data) LOCAL_USER_ADD(u); if (data) { - vtext = ast_strdupa((char *)data); - if (vtext) { + if ((vtext = ast_strdupa(data))) { char *tmp = strsep(&vtext, "|,"); if (vtext) { 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); } } - } 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; } - ltext = ast_strdupa(data); - if (!ltext) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(ltext = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return 0; } diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index e46735d039f65ee63017812efdeb7205e7c85a84..401b15a990202929f46a65b985d14fcfb207471d 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -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); /* Attach only the first format */ - fmt = ast_strdupa(fmt); - if (fmt) { + if ((fmt = ast_strdupa(fmt))) { stringp = fmt; strsep(&stringp, "|"); @@ -3304,8 +3303,6 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, 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"); } 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); ); - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } @@ -5647,9 +5642,7 @@ 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"); + if (!(box = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } @@ -5689,11 +5682,8 @@ static int vmauthenticate(struct ast_channel *chan, void *data) LOCAL_USER_ADD(u); if (s) { - s = ast_strdupa(s); - if (!s) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(s = ast_strdupa(s))) return -1; - } user = strsep(&s, "|"); options = strsep(&s, "|"); if (user) { @@ -6139,8 +6129,7 @@ static int load_config(void) struct vm_zone *z; if ((z = ast_malloc(sizeof(*z)))) { char *msg_format, *timezone; - msg_format = ast_strdupa(var->value); - if (msg_format != NULL) { + if ((msg_format = ast_strdupa(var->value))) { timezone = strsep(&msg_format, "|"); if (msg_format) { ast_copy_string(z->name, var->name, sizeof(z->name)); @@ -6159,7 +6148,6 @@ static int load_config(void) free(z); } } else { - ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n"); free(z); return -1; } diff --git a/apps/app_while.c b/apps/app_while.c index 1ebd8f2b303b26a60f349c284262a6072f54db44..cd7053b218737a7f5fcf35d19fd6d225e2bbcbfe 100644 --- a/apps/app_while.c +++ b/apps/app_while.c @@ -89,9 +89,7 @@ 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"); + if (!(expr = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/apps/app_zapras.c b/apps/app_zapras.c index 94285cb457742cf5ba088fa5e05e0ced7f74a791..e884f64cc7c593402bd507e056bd646ed7827b97 100644 --- a/apps/app_zapras.c +++ b/apps/app_zapras.c @@ -209,9 +209,7 @@ 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"); + if (!(args = ast_strdupa(data))) { LOCAL_USER_REMOVE(u); return -1; } diff --git a/channel.c b/channel.c index f331f6af82987f6eb11a224df98272ba8107aaef..f3f4a30fb5072aabf9b5fbb1f4cd04f3151173ca 100644 --- a/channel.c +++ b/channel.c @@ -3705,12 +3705,9 @@ ast_group_t ast_get_group(char *s) int start=0, finish=0, x; ast_group_t group = 0; - copy = ast_strdupa(s); - if (!copy) { - ast_log(LOG_ERROR, "Out of memory\n"); + c = copy = ast_strdupa(s); + if (!copy) return 0; - } - c = copy; while ((piece = strsep(&c, ","))) { if (sscanf(piece, "%d-%d", &start, &finish) == 2) { diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 68652b1e7891bdc94668ebcb2f6d5d3a13b59c0a..d9c4b86973e7dc1685e796ba7b2b1f0099e57fa0 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -328,11 +328,8 @@ static struct agent_pvt *add_agent(char *agent, int pending) char *agt = NULL; struct agent_pvt *p, *prev; - parse = ast_strdupa(agent); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(agent))) return NULL; - } /* Extract username (agt), password and name from agent (args). */ 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); if (!(parse = ast_strdupa(data))) { - ast_log(LOG_ERROR, "Out of memory!\n"); LOCAL_USER_REMOVE(u); return -1; } @@ -2510,11 +2506,8 @@ static char *function_agent(struct ast_channel *chan, char *cmd, char *data, cha return buf; } - item = ast_strdupa(data); - if (!item) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(item = ast_strdupa(data))) return buf; - } agentid = strsep(&item, ":"); if (!item) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 6238366c8623534a00512e327ba4663ba306886a..b5be2e3da4c0c12f5b388b3bcb82207692b3b4ba 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -8033,11 +8033,8 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr) char *addr; char *portstr; - tmp = ast_strdupa(srcaddr); - if (!tmp) { - ast_log(LOG_WARNING, "Out of memory!\n"); + if (!(tmp = ast_strdupa(srcaddr))) return -1; - } addr = strsep(&tmp, ":"); portstr = tmp; @@ -9174,10 +9171,8 @@ static char *function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, c char *peername, *colname; char iabuf[INET_ADDRSTRLEN]; - if (!(peername = ast_strdupa(data))) { - ast_log(LOG_ERROR, "Memory Error!\n"); + if (!(peername = ast_strdupa(data))) return ret; - } /* if our channel, return the IP address of the endpoint of current channel */ if (!strcmp(peername,"CURRENTCHANNEL")) { diff --git a/channels/chan_sip.c b/channels/chan_sip.c index fd78084b1f564d1bea658db11a1e30f27527beaf..dc0df0d87ac6daaa511baa2b50023aaea23860b3 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -9292,10 +9292,8 @@ static char *function_sippeer(struct ast_channel *chan, char *cmd, char *data, c char *peername, *colname; char iabuf[INET_ADDRSTRLEN]; - if (!(peername = ast_strdupa(data))) { - ast_log(LOG_ERROR, "Memory Error!\n"); + if (!(peername = ast_strdupa(data))) return ret; - } if ((colname = strchr(peername, ':'))) { *colname = '\0'; @@ -12847,11 +12845,9 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest) char *extension, *host, *port; char tmp[80]; - cdest = ast_strdupa(dest); - if (!cdest) { - ast_log(LOG_ERROR, "Problem allocating the memory\n"); + if (!(cdest = ast_strdupa(dest))) return 0; - } + extension = strsep(&cdest, "@"); host = 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"); return 0; } - host = ast_strdupa(lhost); - if (!host) { - ast_log(LOG_ERROR, "Problem allocating the memory\n"); + if (!(host = ast_strdupa(lhost))) return 0; - } if (!ast_strlen_zero(lport)) { - port = ast_strdupa(lport); - if (!port) { - ast_log(LOG_ERROR, "Problem allocating the memory\n"); + if (!(port = ast_strdupa(lport))) return 0; - } } } } diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c index c5cadc7581113d9811650c503c63e0ccba4dfe65..4922b9a933a5e5b00198a325df2fcb628bdb40fc 100644 --- a/funcs/func_cdr.c +++ b/funcs/func_cdr.c @@ -63,11 +63,8 @@ static char *builtin_function_cdr_read(struct ast_channel *chan, char *cmd, char if (!chan->cdr) return NULL; - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) return NULL; - } 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) return; - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) return; - } AST_STANDARD_APP_ARGS(args, parse); diff --git a/funcs/func_cut.c b/funcs/func_cut.c index 1df47030e1e519482f5507b0c96487b6e0f114d6..9064b1e68226421e97d048d8ddcca08d6cfbcd6e 100644 --- a/funcs/func_cut.c +++ b/funcs/func_cut.c @@ -83,10 +83,8 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz return ERROR_NOARG; } - strings = ast_strdupa((char *)data); - if (!strings) { + if (!(strings = ast_strdupa(data))) return ERROR_NOMEM; - } for (ptrkey = strings; *ptrkey; ptrkey++) { if (*ptrkey == '|') { @@ -142,11 +140,8 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size memset(buffer, 0, buflen); - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) return ERROR_NOMEM; - } AST_STANDARD_APP_ARGS(args, parse); diff --git a/funcs/func_logic.c b/funcs/func_logic.c index d1d96abf3fe336244f19ab7484fc72bf39796670..642a4d45c3dc5e3bb71bb072368f7ed5482c4730 100644 --- a/funcs/func_logic.c +++ b/funcs/func_logic.c @@ -55,10 +55,8 @@ static char *builtin_function_iftime(struct ast_channel *chan, char *cmd, char * char *iftrue; char *iffalse; - if (!(data = ast_strdupa(data))) { - ast_log(LOG_WARNING, "Memory Error!\n"); + if (!(data = ast_strdupa(data))) return NULL; - } data = ast_strip_quoted(data, "\"", "\""); expr = strsep(&data, "?"); @@ -95,10 +93,8 @@ static char *builtin_function_if(struct ast_channel *chan, char *cmd, char *data char *iftrue; char *iffalse; - if (!(data = ast_strdupa(data))) { - ast_log(LOG_WARNING, "Memory Error!\n"); + if (!(data = ast_strdupa(data))) return NULL; - } data = ast_strip_quoted(data, "\"", "\""); expr = strsep(&data, "?"); @@ -129,10 +125,8 @@ static char *builtin_function_set(struct ast_channel *chan, char *cmd, char *dat char *varname; char *val; - if (!(data = ast_strdupa(data))) { - ast_log(LOG_WARNING, "Memory Error!\n"); + if (!(data = ast_strdupa(data))) return NULL; - } varname = strsep(&data, "="); val = data; diff --git a/funcs/func_math.c b/funcs/func_math.c index d086fe30478ac487493684957d8565426585662c..ebd7a707b665c31407b34a0d4d1f3a280724188d 100644 --- a/funcs/func_math.c +++ b/funcs/func_math.c @@ -88,11 +88,8 @@ static char *builtin_function_math(struct ast_channel *chan, char *cmd, char *da return NULL; } - parse = ast_strdupa(data); - if(!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) return NULL; - } AST_STANDARD_APP_ARGS(args, parse); diff --git a/funcs/func_md5.c b/funcs/func_md5.c index 552e876ed8564a401dd75e60fe1d28077dbc4428..467799d0cf02745b45e45b4a66f693c27daa2bd4 100644 --- a/funcs/func_md5.c +++ b/funcs/func_md5.c @@ -67,11 +67,8 @@ static char *builtin_function_checkmd5(struct ast_channel *chan, char *cmd, char return NULL; } - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(parse = ast_strdupa(data))) return NULL; - } AST_STANDARD_APP_ARGS(args, parse); diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index 3e0f52fea02adc69518be33ab6cd726a45691e77..f7f7637b3a337da2d9f4690d4046033249994ac1 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -265,9 +265,7 @@ static char *acf_odbc_read(struct ast_channel *chan, char *cmd, char *data, char #endif /* Parse our arguments */ - s = ast_strdupa(data); - if (!s) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(s = ast_strdupa(data))) { ast_mutex_unlock(&query_lock); return ""; } diff --git a/funcs/func_rand.c b/funcs/func_rand.c index dbd82c941bd3f48655996df3f6ad82f7cc5cb4bc..0f1bd0068d018d64f7921812f866878a8e55567b 100644 --- a/funcs/func_rand.c +++ b/funcs/func_rand.c @@ -56,7 +56,6 @@ static char *acf_rand_exec(struct ast_channel *chan, char *cmd, char *data, char LOCAL_USER_ACF_ADD(u); if (!(s = ast_strdupa(data))) { - ast_log(LOG_WARNING, "Out of memory\n"); *buffer = '\0'; LOCAL_USER_REMOVE(u); return buffer; diff --git a/funcs/func_strings.c b/funcs/func_strings.c index 9ea811f62b054b90f6d5ea0d4bdd6e6b582db18b..0e315b79169a6ab83da317c3d5ab03e83a914985 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -51,9 +51,7 @@ static char *function_fieldqty(struct ast_channel *chan, char *cmd, char *data, AST_APP_ARG(delim); ); - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(parse = ast_strdupa(data))) { ast_copy_string(buf, "0", len); return buf; } @@ -90,11 +88,8 @@ static char *builtin_function_filter(struct ast_channel *chan, char *cmd, char * ); char *outbuf=buf; - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory"); + if (!(parse = ast_strdupa(data))) return ""; - } 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); - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory in %s(%s)\n", cmd, data); + if (!(parse = ast_strdupa(data))) return buf; - } 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); value2 = ast_strdupa(value); - if (!var || !value2) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!var || !value2) return; - } /* The functions this will generally be used with are SORT and ODBC_*, which * 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; } - parse = ast_strdupa(data); - if (!parse) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(parse = ast_strdupa(data))) return buf; - } AST_STANDARD_APP_ARGS(args, parse); diff --git a/pbx.c b/pbx.c index 99840addffcc1d1f6fad22e1fcc7847bd2023ac5..75ae5ea7f3a1aaf926d041a6a6722d6b12de198f 100644 --- a/pbx.c +++ b/pbx.c @@ -1219,11 +1219,8 @@ char *ast_func_read(struct ast_channel *chan, const char *in, char *workspace, s char *ret = "0"; struct ast_custom_function *acfptr; - function = ast_strdupa(in); - if (!function) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(function = ast_strdupa(in))) return ret; - } if ((args = strchr(function, '('))) { *args = '\0'; args++; @@ -1254,11 +1251,8 @@ void ast_func_write(struct ast_channel *chan, const char *in, const char *value) char *args = NULL, *function, *p; struct ast_custom_function *acfptr; - function = ast_strdupa(in); - if (!function) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!(function = ast_strdupa(in))) return; - } if ((args = strchr(function, '('))) { *args = '\0'; args++; @@ -5145,11 +5139,8 @@ static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data) struct ast_flags flags = { 0 }; if (!ast_strlen_zero(data)) { - args = ast_strdupa(data); - if (!args) { - ast_log(LOG_ERROR, "Out of memory!\n"); + if (!(args = ast_strdupa(data))) return -1; - } 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 */ if (ast_build_timing(&timing, s) && ast_check_timing(&timing)) res = pbx_builtin_goto(chan, (void *)ts); - } else { - ast_log(LOG_ERROR, "Memory Error!\n"); } return res; } @@ -5227,12 +5216,8 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data) return -1; } - ptr1 = ast_strdupa(data); - - if (!ptr1) { - ast_log(LOG_ERROR, "Out of Memory!\n"); - return -1; - } + if (!(ptr1 = ast_strdupa(data))) + return -1; ptr2 = ptr1; /* Separate the Application data ptr1 is the time spec ptr2 is the app|data */