diff --git a/apps/app_directory.c b/apps/app_directory.c index a53cd7406009155c8f880154911f9676b1ad7e5a..7746502c7ebadfe86ebcddd408a606ffa6340345 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -444,7 +444,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, struct /* Find all candidate extensions */ while(v) { /* Find a candidate extension */ - start = strdup(v->value); + start = ast_strdup(v->value); if (start && !strcasestr(start, "hidefromdir=yes")) { stringp=start; strsep(&stringp, ","); diff --git a/apps/app_meetme.c b/apps/app_meetme.c index d651db45eb421c683439c642f5afb75457c85b94..95faa42e679e0cde0c5579e123341fb20bc6673a 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -984,7 +984,7 @@ static char *complete_meetmecmd(const char *line, const char *word, int pos, int /* User Number || Conf Command option*/ if (strstr(line, "mute") || strstr(line, "kick")) { if (state == 0 && (strstr(line, "kick") || strstr(line,"mute")) && !strncasecmp(word, "all", len)) - return strdup("all"); + return ast_strdup("all"); which++; AST_LIST_LOCK(&confs); @@ -1009,9 +1009,9 @@ static char *complete_meetmecmd(const char *line, const char *word, int pos, int } } AST_LIST_UNLOCK(&confs); - return usr ? strdup(usrno) : NULL; + return usr ? ast_strdup(usrno) : NULL; } else if ( strstr(line, "list") && ( 0 == state ) ) - return strdup("concise"); + return ast_strdup("concise"); } return NULL; diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 4960ecf9971239073afc886a693ddb2eedd9433b..682520b1c769777b8ee09784ee713161f9115f74 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -2333,7 +2333,7 @@ static char *message_template_parse_filebody(char *filename) { static char *message_template_parse_emailbody(const char *configuration) { char *tmpread, *tmpwrite; - char *emailbody = strdup(configuration); + char *emailbody = ast_strdup(configuration); /* substitute strings \t and \n into the apropriate characters */ tmpread = tmpwrite = emailbody; @@ -2678,12 +2678,12 @@ static char *complete_minivm_show_users(const char *line, const char *word, int if (pos > 4) return NULL; if (pos == 3) - return (state == 0) ? strdup("for") : NULL; + return (state == 0) ? ast_strdup("for") : NULL; wordlen = strlen(word); AST_LIST_TRAVERSE(&minivm_accounts, vmu, list) { if (!strncasecmp(word, vmu->domain, wordlen)) { if (domain && strcmp(domain, vmu->domain) && ++which > state) - return strdup(vmu->domain); + return ast_strdup(vmu->domain); /* ignore repeated domains ? */ domain = vmu->domain; } diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index 0956e0bab18bde8f82b3914f57fb426af5207dbc..c18fd6fb883a18732c2bf9f1de617ca0a1d45205 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -515,7 +515,7 @@ static int speech_processing_sound(struct ast_channel *chan, void *data) speech->processing_sound = NULL; } - speech->processing_sound = strdup(data); + speech->processing_sound = ast_strdup(data); ast_module_user_remove(u); @@ -747,8 +747,8 @@ static int speech_background(struct ast_channel *chan, void *data) speech->results = ast_calloc(1, sizeof(*speech->results)); if (speech->results != NULL) { speech->results->score = 1000; - speech->results->text = strdup(dtmf); - speech->results->grammar = strdup("dtmf"); + speech->results->text = ast_strdup(dtmf); + speech->results->grammar = ast_strdup("dtmf"); } } diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 85c912b32ddb9553c6ce058f9efc8473662becda..8291316f2fb9b490f72b6b1d79a9f32cef0ccbef 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -536,7 +536,7 @@ static int oh323_digit_begin(struct ast_channel *c, char digit) ast_log(LOG_DTMF, "Begin sending inband digit %c on %s\n", digit, c->name); } pvt->txDtmfDigit = digit; - token = pvt->cd.call_token ? strdup(pvt->cd.call_token) : NULL; + token = pvt->cd.call_token ? ast_strdup(pvt->cd.call_token) : NULL; ast_mutex_unlock(&pvt->lock); h323_send_tone(token, digit); if (token) { @@ -575,7 +575,7 @@ static int oh323_digit_end(struct ast_channel *c, char digit, unsigned int durat ast_log(LOG_DTMF, "End sending inband digit %c on %s, duration %d\n", digit, c->name, duration); } pvt->txDtmfDigit = ' '; - token = pvt->cd.call_token ? strdup(pvt->cd.call_token) : NULL; + token = pvt->cd.call_token ? ast_strdup(pvt->cd.call_token) : NULL; ast_mutex_unlock(&pvt->lock); h323_send_tone(token, ' '); if (token) { @@ -680,7 +680,7 @@ static int oh323_answer(struct ast_channel *c) ast_debug(1, "Answering on %s\n", c->name); ast_mutex_lock(&pvt->lock); - token = pvt->cd.call_token ? strdup(pvt->cd.call_token) : NULL; + token = pvt->cd.call_token ? ast_strdup(pvt->cd.call_token) : NULL; ast_mutex_unlock(&pvt->lock); res = h323_answering_call(token, 0); if (token) @@ -739,7 +739,7 @@ static int oh323_hangup(struct ast_channel *c) /* Start the process if it's not already started */ if (!pvt->alreadygone && !pvt->hangupcause) { - call_token = pvt->cd.call_token ? strdup(pvt->cd.call_token) : NULL; + call_token = pvt->cd.call_token ? ast_strdup(pvt->cd.call_token) : NULL; if (call_token) { /* Release lock to eliminate deadlock */ ast_mutex_unlock(&pvt->lock); @@ -877,7 +877,7 @@ static int oh323_indicate(struct ast_channel *c, int condition, const void *data int got_progress; ast_mutex_lock(&pvt->lock); - token = (pvt->cd.call_token ? strdup(pvt->cd.call_token) : NULL); + token = (pvt->cd.call_token ? ast_strdup(pvt->cd.call_token) : NULL); got_progress = pvt->got_progress; if (condition == AST_CONTROL_PROGRESS) pvt->got_progress = 1; @@ -1092,7 +1092,7 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c ch->cid.cid_ton = pvt->cd.type_of_number; if (!ast_strlen_zero(pvt->exten) && strcmp(pvt->exten, "s")) { - ch->cid.cid_dnid = strdup(pvt->exten); + ch->cid.cid_dnid = ast_strdup(pvt->exten); } if (pvt->cd.transfer_capability >= 0) ch->transfercapability = pvt->cd.transfer_capability; diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index e74972aa497372a9d42e83d8be13a15825c1352d..f8f671421f238e87c2f433aff148f85e506f3239 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -1409,7 +1409,7 @@ static char *complete_ch_helper(const char *line, const char *word, int pos, int ast_mutex_unlock(&c->lock); } if (c) { - ret = strdup(c->name); + ret = ast_strdup(c->name); ast_mutex_unlock(&c->lock); } else ret = NULL; @@ -1429,13 +1429,13 @@ static char *complete_debug_port (const char *line, const char *word, int pos, i switch (pos) { case 4: if (*word == 'p') - return strdup("port"); + return ast_strdup("port"); else if (*word == 'o') - return strdup("only"); + return ast_strdup("only"); break; case 6: if (*word == 'o') - return strdup("only"); + return ast_strdup("only"); break; } return NULL; @@ -1452,15 +1452,15 @@ static char *complete_show_config (const char *line, const char *word, int pos, switch (pos) { case 3: if ((!strncmp(word, "description", wordlen)) && (++which > state)) - return strdup("description"); + return ast_strdup("description"); if ((!strncmp(word, "descriptions", wordlen)) && (++which > state)) - return strdup("descriptions"); + return ast_strdup("descriptions"); if ((!strncmp(word, "0", wordlen)) && (++which > state)) - return strdup("0"); + return ast_strdup("0"); while ((port = misdn_cfg_get_next_port(port)) != -1) { snprintf(buffer, sizeof(buffer), "%d", port); if ((!strncmp(word, buffer, wordlen)) && (++which > state)) { - return strdup(buffer); + return ast_strdup(buffer); } } break; @@ -1472,14 +1472,14 @@ static char *complete_show_config (const char *line, const char *word, int pos, misdn_cfg_get_name(elem, buffer, sizeof(buffer)); if (!wordlen || !strncmp(word, buffer, wordlen)) { if (++which > state) - return strdup(buffer); + return ast_strdup(buffer); } } } else if (strstr(line, "descriptions ")) { if ((!wordlen || !strncmp(word, "general", wordlen)) && (++which > state)) - return strdup("general"); + return ast_strdup("general"); if ((!wordlen || !strncmp(word, "ports", wordlen)) && (++which > state)) - return strdup("ports"); + return ast_strdup("ports"); } break; } @@ -1895,7 +1895,7 @@ static int read_config(struct chan_list *ch, int orig) if ( !ast_strlen_zero(bc->rad) ) { if (ast->cid.cid_rdnis) ast_free(ast->cid.cid_rdnis); - ast->cid.cid_rdnis = strdup(bc->rad); + ast->cid.cid_rdnis = ast_strdup(bc->rad); } misdn_cfg_get(bc->port, MISDN_CFG_OVERLAP_DIAL, &ch->overlap_dial, sizeof(ch->overlap_dial)); diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc index a89701a6a35efae33b45e1429379a5c8b6dabef2..8e38409e5d444282e2b29cf3d1aa86a291c4b567 100644 --- a/channels/chan_vpb.cc +++ b/channels/chan_vpb.cc @@ -688,8 +688,8 @@ static void get_callerid(struct vpb_pvt *p) if (cli_struct->ra_cldn[0]=='\0'){ /* - owner->cid.cid_num = strdup(cli_struct->cldn); - owner->cid.cid_name = strdup(cli_struct->cn); + owner->cid.cid_num = ast_strdup(cli_struct->cldn); + owner->cid.cid_name = ast_strdup(cli_struct->cn); */ if (owner){ ast_set_callerid(owner, cli_struct->cldn, cli_struct->cn, cli_struct->cldn); @@ -2694,7 +2694,7 @@ static struct ast_channel *vpb_request(const char *type, int format, void *data, int oldformat; struct vpb_pvt *p; struct ast_channel *tmp = NULL; - char *name = strdup(data ? (char *)data : ""); + char *name = ast_strdup(data ? (char *)data : ""); char *s, *sepstr; int group=-1; @@ -2940,7 +2940,7 @@ int load_module() } else if (strcasecmp(v->name, "language") == 0) { strncpy(language, v->value, sizeof(language)-1); } else if (strcasecmp(v->name, "callerid") == 0) { - callerid = strdup(v->value); + callerid = ast_strdup(v->value); } else if (strcasecmp(v->name, "mode") == 0) { if (strncasecmp(v->value, "di", 2) == 0) mode = MODE_DIALTONE; diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c index 4c5727967cd7c86b8e4e63ca917c41ed67feefde..962e6d9582b36e772dfa0da0f24b53cf04462577 100644 --- a/channels/iax2-provision.c +++ b/channels/iax2-provision.c @@ -169,7 +169,7 @@ char *iax_prov_complete_template(const char *line, const char *word, int pos, in ast_mutex_lock(&provlock); for (c = templates; c; c = c->next) { if (!strncasecmp(word, c->name, wordlen) && ++which > state) { - ret = strdup(c->name); + ret = ast_strdup(c->name); break; } } diff --git a/main/asterisk.c b/main/asterisk.c index 2e469729bbc146beefc3e3e9883adc6dea3c7f87..de0f4c14eb3eeb8f910ac2c750407ccaa1639d68 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1980,7 +1980,7 @@ static char **ast_el_strtoarr(char *buf) } } - match_list[matches++] = strdup(retstr); + match_list[matches++] = ast_strdup(retstr); } if (!match_list) diff --git a/main/channel.c b/main/channel.c index 86e4a92b9d4eb0a6abcf2fcafda4458da05a6141..1e3c3ec9ae951867a8a05f913cb638e740852bb4 100644 --- a/main/channel.c +++ b/main/channel.c @@ -295,7 +295,7 @@ static char *complete_channeltypes(const char *line, const char *word, int pos, AST_LIST_TRAVERSE(&backends, cl, list) { if (!strncasecmp(word, cl->tech->type, wordlen) && ++which > state) { - ret = strdup(cl->tech->type); + ret = ast_strdup(cl->tech->type); break; } } diff --git a/main/cli.c b/main/cli.c index fa30bf3e5ffe1575abd67d0644d4ec499ace4a64..e2ddeb3c88aa2e8d235c7d80ae47416beb759bcb 100644 --- a/main/cli.c +++ b/main/cli.c @@ -105,7 +105,7 @@ static char *complete_fn(const char *word, int state) if (c && word[0] != '/') c += (strlen(ast_config_AST_MODULE_DIR) + 1); - return c ? strdup(c) : c; + return c ? ast_strdup(c) : c; } static char *handle_load(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) @@ -693,7 +693,7 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str /* XXX remember to handle the optional "off" */ if (a->pos != e->args) return NULL; - return a->n == 0 ? strdup("all") : ast_complete_channels(a->line, a->word, a->pos, a->n - 1, e->args); + return a->n == 0 ? ast_strdup("all") : ast_complete_channels(a->line, a->word, a->pos, a->n - 1, e->args); } /* 'core set debug channel {all|chan_id}' */ if (a->argc == e->args + 2) { @@ -1027,7 +1027,7 @@ static int set_full_cmd(struct ast_cli_entry *e) char buf[80]; ast_join(buf, sizeof(buf), e->cmda); - e->_full_cmd = strdup(buf); + e->_full_cmd = ast_strdup(buf); if (!e->_full_cmd) { ast_log(LOG_WARNING, "-- cannot allocate <%s>\n", buf); return -1; @@ -1144,7 +1144,7 @@ static char *is_prefix(const char *word, const char *token, if (strncasecmp(token, word, lw)) /* no match */ return NULL; *actual = 1; - return (pos != 0) ? NULL : strdup(token); + return (pos != 0) ? NULL : ast_strdup(token); } /* now handle regexp match */ @@ -1158,7 +1158,7 @@ static char *is_prefix(const char *word, const char *token, continue; (*actual)++; if (pos-- == 0) - return strdup(s); + return ast_strdup(s); } return NULL; } diff --git a/main/enum.c b/main/enum.c index a54506045e26280f4042fce21e56e930bf20117c..1c9d34184972bf38e00ed554aa4bb5d5ea8f5b63 100644 --- a/main/enum.c +++ b/main/enum.c @@ -345,8 +345,8 @@ static int enum_callback(void *context, unsigned char *answer, int len, unsigned if ((p = ast_realloc(c->naptr_rrs, sizeof(*c->naptr_rrs) * (c->naptr_rrs_count + 1)))) { c->naptr_rrs = p; memcpy(&c->naptr_rrs[c->naptr_rrs_count].naptr, answer, sizeof(c->naptr_rrs->naptr)); - c->naptr_rrs[c->naptr_rrs_count].result = strdup(c->dst); - c->naptr_rrs[c->naptr_rrs_count].tech = strdup(c->tech); + c->naptr_rrs[c->naptr_rrs_count].result = ast_strdup(c->dst); + c->naptr_rrs[c->naptr_rrs_count].tech = ast_strdup(c->tech); c->naptr_rrs[c->naptr_rrs_count].sort_pos = c->naptr_rrs_count; c->naptr_rrs_count++; } diff --git a/main/file.c b/main/file.c index cd5e2e43556f46193e02399845a0ca1c33d33bcc..3c809e9c02b771ca2d1a25d92d67dec93f9ad65b 100644 --- a/main/file.c +++ b/main/file.c @@ -839,7 +839,7 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons fs->fmt = f; fs->flags = flags; fs->mode = mode; - fs->filename = strdup(filename); + fs->filename = ast_strdup(filename); fs->vfs = NULL; break; } @@ -950,11 +950,11 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con fs->flags = flags; fs->mode = mode; if (orig_fn) { - fs->realfilename = strdup(orig_fn); - fs->filename = strdup(fn); + fs->realfilename = ast_strdup(orig_fn); + fs->filename = ast_strdup(fn); } else { fs->realfilename = NULL; - fs->filename = strdup(filename); + fs->filename = ast_strdup(filename); } fs->vfs = NULL; /* If truncated, we'll be at the beginning; if not truncated, then append */ diff --git a/main/http.c b/main/http.c index 2967298e7b89a54fd37a2b0d27c454b27e20dcd0..c385c34c53d52d396ad2e7eedbf450e568a8fb99 100644 --- a/main/http.c +++ b/main/http.c @@ -215,12 +215,12 @@ static struct ast_str *static_callback(struct sockaddr_in *req, const char *uri, out404: *status = 404; - *title = strdup("Not Found"); + *title = ast_strdup("Not Found"); return ast_http_error(404, "Not Found", NULL, "Nothing to see here. Move along."); out403: *status = 403; - *title = strdup("Access Denied"); + *title = ast_strdup("Access Denied"); return ast_http_error(403, "Access Denied", NULL, "Sorry, I cannot let you do that, Dave."); } @@ -616,7 +616,7 @@ static struct ast_str *handle_uri(struct sockaddr_in *sin, char *uri, int *statu out = ast_http_error(302, "Moved Temporarily", buf, "There is no spoon..."); *status = 302; - *title = strdup("Moved Temporarily"); + *title = ast_strdup("Moved Temporarily"); break; } } @@ -655,7 +655,7 @@ static struct ast_str *handle_uri(struct sockaddr_in *sin, char *uri, int *statu out = ast_http_error(404, "Not Found", NULL, "The requested URL was not found on this server."); *status = 404; - *title = strdup("Not Found"); + *title = ast_strdup("Not Found"); } cleanup: diff --git a/main/loader.c b/main/loader.c index 060243ccc0f5cb8840a69ae64f6abe138cc51702..cd4e09ba4bf9ca285e7bbca9af0080c4e85691d1 100644 --- a/main/loader.c +++ b/main/loader.c @@ -526,7 +526,7 @@ char *ast_module_helper(const char *line, const char *word, int pos, int state, if (!strncasecmp(word, cur->resource, l) && (cur->info->reload || !needsreload) && ++which > state) { - ret = strdup(cur->resource); + ret = ast_strdup(cur->resource); break; } } @@ -535,7 +535,7 @@ char *ast_module_helper(const char *line, const char *word, int pos, int state, if (!ret) { for (i=0; !ret && reload_classes[i].name; i++) { if (!strncasecmp(word, reload_classes[i].name, l) && ++which > state) - ret = strdup(reload_classes[i].name); + ret = ast_strdup(reload_classes[i].name); } } diff --git a/main/pbx.c b/main/pbx.c index e01b7c9adb77c0bb906f013af66aa6b815ab4ccb..74235f581db5d824d3c6cb95c44c2a2eff3b6ef9 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1360,7 +1360,7 @@ static char *complete_show_function(const char *line, const char *word, int pos, AST_RWLIST_RDLOCK(&acf_root); AST_RWLIST_TRAVERSE(&acf_root, acf, acflist) { if (!strncasecmp(word, acf->name, wordlen) && ++which > state) { - ret = strdup(acf->name); + ret = ast_strdup(acf->name); break; } } @@ -3066,7 +3066,7 @@ static char *complete_show_application(const char *line, const char *word, int p AST_RWLIST_RDLOCK(&apps); AST_RWLIST_TRAVERSE(&apps, a, list) { if (!strncasecmp(word, a->name, wordlen) && ++which > state) { - ret = strdup(a->name); + ret = ast_strdup(a->name); break; } } diff --git a/res/res_features.c b/res/res_features.c index bd8504f05b58dbf176b2f3d7f24c37a7372f9378..7575b2797759680eacf430fdc110a5b4db234d9a 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -469,7 +469,7 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou if (!con) /* Still no context? Bad */ ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con); else { /* Add extension to context */ - if (!ast_add_extension2(con, 1, pu->parkingexten, 1, NULL, NULL, parkedcall, strdup(pu->parkingexten), ast_free, registrar)) + if (!ast_add_extension2(con, 1, pu->parkingexten, 1, NULL, NULL, parkedcall, ast_strdup(pu->parkingexten), ast_free, registrar)) notify_metermaids(pu->parkingexten, parking_con); } /* Tell the peer channel the number of the parking space */ @@ -1937,7 +1937,7 @@ static void *do_parking_thread(void *ignore) if (con) { char returnexten[AST_MAX_EXTENSION]; snprintf(returnexten, sizeof(returnexten), "%s||t", peername); - ast_add_extension2(con, 1, peername, 1, NULL, NULL, "Dial", strdup(returnexten), ast_free, registrar); + ast_add_extension2(con, 1, peername, 1, NULL, NULL, "Dial", ast_strdup(returnexten), ast_free, registrar); } if (comebacktoorigin) { set_c_e_p(chan, parking_con_dial, peername, 1); diff --git a/res/res_indications.c b/res/res_indications.c index 1a8aafc761077efb5e962fc53f8c28fc17642406..7397218dc99d34c6e7a9c1f0da3819bc0634758f 100644 --- a/res/res_indications.c +++ b/res/res_indications.c @@ -314,8 +314,8 @@ static int ind_load_module(void) return -1; } ts->next = NULL; - ts->name = strdup(v->name); - ts->data = strdup(v->value); + ts->name = ast_strdup(v->name); + ts->data = ast_strdup(v->value); if (ps) ps->next = ts; else diff --git a/res/res_monitor.c b/res/res_monitor.c index d23c6f727f1d67b1f8f19f54a5dea9d05a1f0c93..a01d953a31f217f2167d2439d2264e62c9fd9cbb 100644 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -154,7 +154,7 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, int directory = strchr(fname_base, '/') ? 1 : 0; /* try creating the directory just in case it doesn't exist */ if (directory) { - char *name = strdup(fname_base); + char *name = ast_strdup(fname_base); snprintf(tmp, sizeof(tmp), "mkdir -p \"%s\"",dirname(name)); ast_free(name); ast_safe_system(tmp); @@ -186,9 +186,9 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, /* Determine file format */ if (!ast_strlen_zero(format_spec)) { - monitor->format = strdup(format_spec); + monitor->format = ast_strdup(format_spec); } else { - monitor->format = strdup("wav"); + monitor->format = ast_strdup("wav"); } /* open files */ @@ -366,7 +366,7 @@ int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, i int directory = strchr(fname_base, '/') ? 1 : 0; /* try creating the directory just in case it doesn't exist */ if (directory) { - char *name = strdup(fname_base); + char *name = ast_strdup(fname_base); snprintf(tmp, sizeof(tmp), "mkdir -p %s",dirname(name)); ast_free(name); ast_safe_system(tmp);