<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13097">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">various files - fix some alerts raised by lgtm code analysis<br><br>This patch fixes several issues reported by the lgtm code analysis tool:<br><br>https://lgtm.com/projects/g/asterisk/asterisk<br><br>Not all reported issues were addressed in this patch. This patch mostly fixes<br>confirmed reported errors, potential problematic code points, and a few other<br>"low hanging" warnings or recommendations found in core supported modules.<br>These include, but are not limited to the following:<br><br>* innapropriate stack allocation in loops<br>* buffer overflows<br>* variable declaration "hiding" another variable declaration<br>* comparisons results that are always the same<br>* ambiguously signed bit-field members<br>* missing header guards<br><br>Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25<br>---<br>M apps/app_cdr.c<br>M apps/app_dictate.c<br>M apps/app_followme.c<br>M apps/app_minivm.c<br>M apps/app_playback.c<br>M apps/app_readexten.c<br>M apps/app_voicemail.c<br>M channels/chan_dahdi.c<br>M channels/chan_dahdi.h<br>M channels/chan_motif.c<br>M codecs/ex_alaw.h<br>M codecs/ex_g722.h<br>M codecs/ex_ulaw.h<br>M formats/format_g726.c<br>M formats/msgsm.h<br>M include/asterisk/ari.h<br>M include/asterisk/calendar.h<br>M include/asterisk/channel_internal.h<br>M include/asterisk/config_options.h<br>M include/asterisk/dns_internal.h<br>M include/asterisk/max_forwards.h<br>M include/asterisk/mixmonitor.h<br>M include/asterisk/parking.h<br>M include/asterisk/res_pjsip_presence_xml.h<br>M include/asterisk/slin.h<br>M main/app.c<br>M main/asterisk.c<br>M main/event.c<br>M main/file.c<br>M main/indications.c<br>M main/manager.c<br>M main/pbx_variables.c<br>M main/stasis.c<br>M main/stasis_cache.c<br>M res/ari/config.c<br>M res/parking/parking_bridge_features.c<br>M res/parking/res_parking.h<br>M res/res_config_curl.c<br>M res/res_phoneprov.c<br>M res/res_pjsip/config_system.c<br>M res/res_pjsip/config_transport.c<br>M res/res_pjsip/pjsip_resolver.c<br>M res/res_pjsip_endpoint_identifier_ip.c<br>M res/res_pjsip_registrar.c<br>M res/res_pjsip_t38.c<br>M res/res_resolver_unbound.c<br>M res/res_rtp_asterisk.c<br>M res/stasis/command.c<br>M res/stasis/control.c<br>49 files changed, 324 insertions(+), 203 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_cdr.c b/apps/app_cdr.c</span><br><span>index 1500c89..3e52302 100644</span><br><span>--- a/apps/app_cdr.c</span><br><span>+++ b/apps/app_cdr.c</span><br><span>@@ -119,13 +119,13 @@</span><br><span> /*! The name of the channel to be manipulated */</span><br><span> const char *channel_name;</span><br><span> /*! Disable the CDR for this channel */</span><br><span style="color: hsl(0, 100%, 40%);">- int disable:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int disable:1;</span><br><span> /*! Re-enable the CDR for this channel */</span><br><span style="color: hsl(0, 100%, 40%);">- int reenable:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int reenable:1;</span><br><span> /*! Reset the CDR */</span><br><span style="color: hsl(0, 100%, 40%);">- int reset:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int reset:1;</span><br><span> /*! If reseting the CDR, keep the variables */</span><br><span style="color: hsl(0, 100%, 40%);">- int keep_variables:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int keep_variables:1;</span><br><span> };</span><br><span> </span><br><span> static void appcdr_callback(void *data, struct stasis_subscription *sub, struct stasis_message *message)</span><br><span>diff --git a/apps/app_dictate.c b/apps/app_dictate.c</span><br><span>index d184512..c64f275 100644</span><br><span>--- a/apps/app_dictate.c</span><br><span>+++ b/apps/app_dictate.c</span><br><span>@@ -149,7 +149,8 @@</span><br><span> ast_mkdir(base, 0755);</span><br><span> len = strlen(base) + strlen(filein) + 2;</span><br><span> if (!path || len > maxlen) {</span><br><span style="color: hsl(0, 100%, 40%);">- path = ast_alloca(len);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(path);</span><br><span style="color: hsl(120, 100%, 40%);">+ path = ast_malloc(len);</span><br><span> memset(path, 0, len);</span><br><span> maxlen = len;</span><br><span> } else {</span><br><span>@@ -334,6 +335,7 @@</span><br><span> ast_frfree(f);</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(path);</span><br><span> if (oldr) {</span><br><span> ast_set_read_format(chan, oldr);</span><br><span> ao2_ref(oldr, -1);</span><br><span>diff --git a/apps/app_followme.c b/apps/app_followme.c</span><br><span>index c5b70ec..bc60b36 100644</span><br><span>--- a/apps/app_followme.c</span><br><span>+++ b/apps/app_followme.c</span><br><span>@@ -408,7 +408,6 @@</span><br><span> char *cat = NULL, *tmp;</span><br><span> struct ast_variable *var;</span><br><span> struct number *cur, *nm;</span><br><span style="color: hsl(0, 100%, 40%);">- char *numberstr;</span><br><span> int timeout;</span><br><span> int numorder;</span><br><span> const char* enable_callee_prompt_str;</span><br><span>@@ -536,9 +535,12 @@</span><br><span> while (var) {</span><br><span> if (!strcasecmp(var->name, "number")) {</span><br><span> int idx = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ char copy[strlen(var->value) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+ char *numberstr;</span><br><span> </span><br><span> /* Add a new number */</span><br><span style="color: hsl(0, 100%, 40%);">- numberstr = ast_strdupa(var->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(copy, var->value); /* safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ numberstr = copy;</span><br><span> if ((tmp = strchr(numberstr, ','))) {</span><br><span> *tmp++ = '\0';</span><br><span> timeout = atoi(tmp);</span><br><span>@@ -762,10 +764,6 @@</span><br><span> }</span><br><span> </span><br><span> tmpto = to;</span><br><span style="color: hsl(0, 100%, 40%);">- if (to < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- to = 1000;</span><br><span style="color: hsl(0, 100%, 40%);">- tmpto = 1000;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> towas = to;</span><br><span> winner = ast_waitfor_n(watchers, pos, &to);</span><br><span> tmpto -= to;</span><br><span>diff --git a/apps/app_minivm.c b/apps/app_minivm.c</span><br><span>index 5c9e57e..2d26e78 100644</span><br><span>--- a/apps/app_minivm.c</span><br><span>+++ b/apps/app_minivm.c</span><br><span>@@ -2652,9 +2652,10 @@</span><br><span> ast_copy_string(vmu->fullname, var->value, sizeof(vmu->fullname));</span><br><span> } else if (!strcasecmp(var->name, "setvar")) {</span><br><span> char *varval;</span><br><span style="color: hsl(0, 100%, 40%);">- char *varname = ast_strdupa(var->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ char varname[strlen(var->value) + 1];</span><br><span> struct ast_variable *tmpvar;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(varname, var->value); /* safe */</span><br><span> if ((varval = strchr(varname, '='))) {</span><br><span> *varval = '\0';</span><br><span> varval++;</span><br><span>diff --git a/apps/app_playback.c b/apps/app_playback.c</span><br><span>index 5303bb4..0c9281a 100644</span><br><span>--- a/apps/app_playback.c</span><br><span>+++ b/apps/app_playback.c</span><br><span>@@ -173,7 +173,10 @@</span><br><span> static int do_say(say_args_t *a, const char *s, const char *options, int depth)</span><br><span> {</span><br><span> struct ast_variable *v;</span><br><span style="color: hsl(0, 100%, 40%);">- char *lang, *x, *rule = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *lang;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *x;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *rule = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *rule_head = NULL;</span><br><span> int ret = 0;</span><br><span> struct varshead head = { .first = NULL, .last = NULL };</span><br><span> struct ast_var_t *n;</span><br><span>@@ -195,7 +198,7 @@</span><br><span> for (;;) {</span><br><span> for (v = ast_variable_browse(say_cfg, lang); v ; v = v->next) {</span><br><span> if (ast_extension_match(v->name, s)) {</span><br><span style="color: hsl(0, 100%, 40%);">- rule = ast_strdupa(v->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ rule_head = rule = ast_strdup(v->value);</span><br><span> break;</span><br><span> }</span><br><span> }</span><br><span>@@ -220,6 +223,7 @@</span><br><span> n = ast_var_assign("SAY", s);</span><br><span> if (!n) {</span><br><span> ast_log(LOG_ERROR, "Memory allocation error in do_say\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(rule_head);</span><br><span> return -1;</span><br><span> }</span><br><span> AST_LIST_INSERT_HEAD(&head, n, entries);</span><br><span>@@ -281,6 +285,7 @@</span><br><span> }</span><br><span> }</span><br><span> ast_var_delete(n);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(rule_head);</span><br><span> return ret;</span><br><span> }</span><br><span> </span><br><span>diff --git a/apps/app_readexten.c b/apps/app_readexten.c</span><br><span>index e32c53c..8f5f0a7 100644</span><br><span>--- a/apps/app_readexten.c</span><br><span>+++ b/apps/app_readexten.c</span><br><span>@@ -170,8 +170,7 @@</span><br><span> if (timeout <= 0)</span><br><span> timeout = ast_channel_pbx(chan) ? ast_channel_pbx(chan)->rtimeoutms : 10000;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (digit_timeout <= 0)</span><br><span style="color: hsl(0, 100%, 40%);">- digit_timeout = ast_channel_pbx(chan) ? ast_channel_pbx(chan)->dtimeoutms : 5000;</span><br><span style="color: hsl(120, 100%, 40%);">+ digit_timeout = ast_channel_pbx(chan) ? ast_channel_pbx(chan)->dtimeoutms : 5000;</span><br><span> </span><br><span> if (ast_test_flag(&flags, OPT_INDICATION) && !ast_strlen_zero(arglist.filename)) {</span><br><span> ts = ast_get_indication_tone(ast_channel_zone(chan), arglist.filename);</span><br><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index 57f22cd..cf944fd 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -1797,7 +1797,7 @@</span><br><span> struct ast_config *cfg = NULL;</span><br><span> struct ast_variable *var = NULL;</span><br><span> struct ast_category *cat = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- char *category = NULL, *value = NULL, *new = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *category = NULL;</span><br><span> const char *tmp = NULL;</span><br><span> struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };</span><br><span> char secretfn[PATH_MAX] = "";</span><br><span>@@ -1824,24 +1824,28 @@</span><br><span> if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) && valid_config(cfg)) {</span><br><span> while ((category = ast_category_browse(cfg, category))) {</span><br><span> if (!strcasecmp(category, vmu->context)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ char *value = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *new = NULL;</span><br><span> if (!(tmp = ast_variable_retrieve(cfg, category, vmu->mailbox))) {</span><br><span> ast_log(AST_LOG_WARNING, "We could not find the mailbox.\n");</span><br><span> break;</span><br><span> }</span><br><span> value = strstr(tmp, ",");</span><br><span> if (!value) {</span><br><span style="color: hsl(0, 100%, 40%);">- new = ast_alloca(strlen(newpassword)+1);</span><br><span style="color: hsl(120, 100%, 40%);">+ new = ast_malloc(strlen(newpassword) + 1);</span><br><span> sprintf(new, "%s", newpassword);</span><br><span> } else {</span><br><span style="color: hsl(0, 100%, 40%);">- new = ast_alloca((strlen(value) + strlen(newpassword) + 1));</span><br><span style="color: hsl(120, 100%, 40%);">+ new = ast_malloc((strlen(value) + strlen(newpassword) + 1));</span><br><span> sprintf(new, "%s%s", newpassword, value);</span><br><span> }</span><br><span> if (!(cat = ast_category_get(cfg, category, NULL))) {</span><br><span> ast_log(AST_LOG_WARNING, "Failed to get category structure.\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(new);</span><br><span> break;</span><br><span> }</span><br><span> ast_variable_update(cat, vmu->mailbox, new, NULL, 0);</span><br><span> found = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(new);</span><br><span> }</span><br><span> }</span><br><span> /* save the results */</span><br><span>@@ -1865,13 +1869,14 @@</span><br><span> for (category = ast_category_browse(cfg, NULL); category; category = ast_category_browse(cfg, category)) {</span><br><span> ast_debug(4, "users.conf: %s\n", category);</span><br><span> if (!strcasecmp(category, vmu->mailbox)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ char new[strlen(newpassword) + 1];</span><br><span> if (!ast_variable_retrieve(cfg, category, "vmsecret")) {</span><br><span> ast_debug(3, "looks like we need to make vmsecret!\n");</span><br><span> var = ast_variable_new("vmsecret", newpassword, "");</span><br><span> } else {</span><br><span> var = NULL;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- new = ast_alloca(strlen(newpassword) + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> sprintf(new, "%s", newpassword);</span><br><span> if (!(cat = ast_category_get(cfg, category, NULL))) {</span><br><span> ast_debug(4, "failed to get category!\n");</span><br><span>@@ -2194,7 +2199,6 @@</span><br><span> struct vm_state *vms_p;</span><br><span> char *file, *filename;</span><br><span> char dest[PATH_MAX];</span><br><span style="color: hsl(0, 100%, 40%);">- char *attachment;</span><br><span> int i;</span><br><span> BODY *body;</span><br><span> int ret = 0;</span><br><span>@@ -2247,21 +2251,26 @@</span><br><span> mail_fetchstructure(vms_p->mailstream, i + 1, &body);</span><br><span> /* We have the body, now we extract the file name of the first attachment. */</span><br><span> if (body->nested.part && body->nested.part->next && body->nested.part->next->body.parameter->value) {</span><br><span style="color: hsl(0, 100%, 40%);">- attachment = ast_strdupa(body->nested.part->next->body.parameter->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ char *attachment = body->nested.part->next->body.parameter->value;</span><br><span style="color: hsl(120, 100%, 40%);">+ char copy[strlen(attachment) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(copy, attachment); /* safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ attachment = copy;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ filename = strsep(&attachment, ".");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strcmp(filename, file)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(vms_p->fn, dir, sizeof(vms_p->fn));</span><br><span style="color: hsl(120, 100%, 40%);">+ vms_p->msgArray[vms_p->curmsg] = i + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ create_dirpath(dest, sizeof(dest), vmu->context, vms_p->username, "");</span><br><span style="color: hsl(120, 100%, 40%);">+ save_body(body, vms_p, "2", attachment, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ ret = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> } else {</span><br><span> ast_log(AST_LOG_ERROR, "There is no file attached to this IMAP message.\n");</span><br><span> ret = -1;</span><br><span> break;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- filename = strsep(&attachment, ".");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcmp(filename, file)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(vms_p->fn, dir, sizeof(vms_p->fn));</span><br><span style="color: hsl(0, 100%, 40%);">- vms_p->msgArray[vms_p->curmsg] = i + 1;</span><br><span style="color: hsl(0, 100%, 40%);">- create_dirpath(dest, sizeof(dest), vmu->context, vms_p->username, "");</span><br><span style="color: hsl(0, 100%, 40%);">- save_body(body, vms_p, "2", attachment, 0);</span><br><span style="color: hsl(0, 100%, 40%);">- ret = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> }</span><br><span> </span><br><span> if (curr_mbox != -1) {</span><br><span>@@ -8141,10 +8150,12 @@</span><br><span> </span><br><span> aliases = ao2_find(mailbox_alias_mappings, box, OBJ_SEARCH_KEY | OBJ_MULTIPLE);</span><br><span> while ((mapping = ao2_iterator_next(aliases))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ char alias[strlen(mapping->alias) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(alias, mapping->alias); /* safe */</span><br><span> mailbox = NULL;</span><br><span> context = NULL;</span><br><span> ast_debug(3, "Found alias mapping: %s -> %s\n", mapping->alias, box);</span><br><span style="color: hsl(0, 100%, 40%);">- separate_mailbox(ast_strdupa(mapping->alias), &mailbox, &context);</span><br><span style="color: hsl(120, 100%, 40%);">+ separate_mailbox(alias, &mailbox, &context);</span><br><span> ast_publish_mwi_state_channel(mailbox, context, new + urgent, old, channel_id);</span><br><span> ao2_ref(mapping, -1);</span><br><span> }</span><br><span>@@ -8364,12 +8375,12 @@</span><br><span> directory_app = pbx_findapp("Directory");</span><br><span> if (directory_app) {</span><br><span> char vmcontext[256];</span><br><span style="color: hsl(0, 100%, 40%);">- char *old_context;</span><br><span style="color: hsl(0, 100%, 40%);">- char *old_exten;</span><br><span style="color: hsl(120, 100%, 40%);">+ char old_context[strlen(ast_channel_context(chan)) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+ char old_exten[strlen(ast_channel_exten(chan)) + 1];</span><br><span> int old_priority;</span><br><span> /* make backup copies */</span><br><span style="color: hsl(0, 100%, 40%);">- old_context = ast_strdupa(ast_channel_context(chan));</span><br><span style="color: hsl(0, 100%, 40%);">- old_exten = ast_strdupa(ast_channel_exten(chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(old_context, ast_channel_context(chan)); /* safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(old_exten, ast_channel_exten(chan)); /* safe */</span><br><span> old_priority = ast_channel_priority(chan);</span><br><span> </span><br><span> /* call the Directory, changes the channel */</span><br><span>@@ -9050,7 +9061,6 @@</span><br><span> static int imap_delete_old_greeting (char *dir, struct vm_state *vms)</span><br><span> {</span><br><span> char *file, *filename;</span><br><span style="color: hsl(0, 100%, 40%);">- char *attachment;</span><br><span> char arg[11];</span><br><span> int i;</span><br><span> BODY* body;</span><br><span>@@ -9079,17 +9089,22 @@</span><br><span> mail_fetchstructure(vms->mailstream, i + 1, &body);</span><br><span> /* We have the body, now we extract the file name of the first attachment. */</span><br><span> if (body->nested.part->next && body->nested.part->next->body.parameter->value) {</span><br><span style="color: hsl(0, 100%, 40%);">- attachment = ast_strdupa(body->nested.part->next->body.parameter->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ char *attachment = body->nested.part->next->body.parameter->value;</span><br><span style="color: hsl(120, 100%, 40%);">+ char copy[strlen(attachment) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(copy, attachment); /* safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ attachment = copy;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ filename = strsep(&attachment, ".");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strcmp(filename, file)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(arg, sizeof(arg), "%d", i + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ mail_setflag(vms->mailstream, arg, "\\DELETED");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> } else {</span><br><span> ast_log(AST_LOG_ERROR, "There is no file attached to this IMAP message.\n");</span><br><span> ast_mutex_unlock(&vms->lock);</span><br><span> return -1;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- filename = strsep(&attachment, ".");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcmp(filename, file)) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(arg, sizeof(arg), "%d", i + 1);</span><br><span style="color: hsl(0, 100%, 40%);">- mail_setflag(vms->mailstream, arg, "\\DELETED");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> }</span><br><span> mail_expunge(vms->mailstream);</span><br><span> </span><br><span>@@ -13705,26 +13720,30 @@</span><br><span> </span><br><span> var = ast_variable_browse(cfg, "zonemessages");</span><br><span> while (var) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct vm_zone *z;</span><br><span style="color: hsl(0, 100%, 40%);">- char *msg_format, *tzone;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (var->value) {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct vm_zone *z;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *msg_format, *tzone;</span><br><span style="color: hsl(120, 100%, 40%);">+ char storage[strlen(var->value) + 1];</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- z = ast_malloc(sizeof(*z));</span><br><span style="color: hsl(0, 100%, 40%);">- if (!z) {</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ z = ast_malloc(sizeof(*z));</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!z) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- msg_format = ast_strdupa(var->value);</span><br><span style="color: hsl(0, 100%, 40%);">- tzone = strsep(&msg_format, "|,");</span><br><span style="color: hsl(0, 100%, 40%);">- if (msg_format) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(z->name, var->name, sizeof(z->name));</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(z->timezone, tzone, sizeof(z->timezone));</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));</span><br><span style="color: hsl(0, 100%, 40%);">- AST_LIST_LOCK(&zones);</span><br><span style="color: hsl(0, 100%, 40%);">- AST_LIST_INSERT_HEAD(&zones, z, list);</span><br><span style="color: hsl(0, 100%, 40%);">- AST_LIST_UNLOCK(&zones);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(AST_LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(z);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(storage, var->value); /* safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ msg_format = storage;</span><br><span style="color: hsl(120, 100%, 40%);">+ tzone = strsep(&msg_format, "|,");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (msg_format) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(z->name, var->name, sizeof(z->name));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(z->timezone, tzone, sizeof(z->timezone));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_LIST_LOCK(&zones);</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_LIST_INSERT_HEAD(&zones, z, list);</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_LIST_UNLOCK(&zones);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(AST_LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(z);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> var = var->next;</span><br><span> }</span><br><span>diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c</span><br><span>index d9293bc..fd49489 100644</span><br><span>--- a/channels/chan_dahdi.c</span><br><span>+++ b/channels/chan_dahdi.c</span><br><span>@@ -4382,7 +4382,7 @@</span><br><span> static const char *event2str(int event)</span><br><span> {</span><br><span> static char buf[256];</span><br><span style="color: hsl(0, 100%, 40%);">- if ((event < (ARRAY_LEN(events))) && (event > -1))</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((event > -1) && (event < (ARRAY_LEN(events))) )</span><br><span> return events[event];</span><br><span> sprintf(buf, "Event %d", event); /* safe */</span><br><span> return buf;</span><br><span>@@ -15174,7 +15174,7 @@</span><br><span> inside_range = 0;</span><br><span> len = 0;</span><br><span> /* Prepare nice string in channel_list[] */</span><br><span style="color: hsl(0, 100%, 40%);">- for (i = 0; i < mfcr2->numchans; i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ for (i = 0; i < mfcr2->numchans && len < sizeof(channel_list) - 1; i++) {</span><br><span> struct dahdi_pvt *p = mfcr2->pvts[i];</span><br><span> if (!p) {</span><br><span> continue;</span><br><span>@@ -18132,13 +18132,17 @@</span><br><span> } else if (!strcasecmp(v->name, "namedpickupgroup")) {</span><br><span> confp->chan.named_pickupgroups = ast_get_namedgroups(v->value);</span><br><span> } else if (!strcasecmp(v->name, "setvar")) {</span><br><span style="color: hsl(0, 100%, 40%);">- char *varname = ast_strdupa(v->value), *varval = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_variable *tmpvar;</span><br><span style="color: hsl(0, 100%, 40%);">- if (varname && (varval = strchr(varname, '='))) {</span><br><span style="color: hsl(0, 100%, 40%);">- *varval++ = '\0';</span><br><span style="color: hsl(0, 100%, 40%);">- if ((tmpvar = ast_variable_new(varname, varval, ""))) {</span><br><span style="color: hsl(0, 100%, 40%);">- tmpvar->next = confp->chan.vars;</span><br><span style="color: hsl(0, 100%, 40%);">- confp->chan.vars = tmpvar;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (v->value) {</span><br><span style="color: hsl(120, 100%, 40%);">+ char *varval = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_variable *tmpvar;</span><br><span style="color: hsl(120, 100%, 40%);">+ char varname[strlen(v->value) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(varname, v->value); /* safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((varval = strchr(varname, '='))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ *varval++ = '\0';</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((tmpvar = ast_variable_new(varname, varval, ""))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ tmpvar->next = confp->chan.vars;</span><br><span style="color: hsl(120, 100%, 40%);">+ confp->chan.vars = tmpvar;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> }</span><br><span> } else if (!strcasecmp(v->name, "immediate")) {</span><br><span>@@ -19082,9 +19086,12 @@</span><br><span> } else if (!strcasecmp(v->name, "mfcr2_logging")) {</span><br><span> openr2_log_level_t tmplevel;</span><br><span> char *clevel;</span><br><span style="color: hsl(0, 100%, 40%);">- char *logval = ast_strdupa(v->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ char *logval;</span><br><span style="color: hsl(120, 100%, 40%);">+ char copy[strlen(v->value) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(copy, v->value); /* safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ logval = copy;</span><br><span> while (logval) {</span><br><span style="color: hsl(0, 100%, 40%);">- clevel = strsep(&logval,",");</span><br><span style="color: hsl(120, 100%, 40%);">+ clevel = strsep(&logval,",");</span><br><span> if (-1 == (tmplevel = openr2_log_get_level(clevel))) {</span><br><span> ast_log(LOG_WARNING, "Ignoring invalid logging level: '%s' at line %d.\n", clevel, v->lineno);</span><br><span> continue;</span><br><span>diff --git a/channels/chan_dahdi.h b/channels/chan_dahdi.h</span><br><span>index d84be51..f98ebdc 100644</span><br><span>--- a/channels/chan_dahdi.h</span><br><span>+++ b/channels/chan_dahdi.h</span><br><span>@@ -692,15 +692,15 @@</span><br><span> openr2_calling_party_category_t mfcr2_category;</span><br><span> int mfcr2_dnis_index;</span><br><span> int mfcr2_ani_index;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2call:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2_answer_pending:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2_charge_calls:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2_allow_collect_calls:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2_forced_release:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2_dnis_matched:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2_call_accepted:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2_accept_on_offer:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int mfcr2_progress_sent:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2call:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2_answer_pending:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2_charge_calls:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2_allow_collect_calls:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2_forced_release:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2_dnis_matched:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2_call_accepted:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2_accept_on_offer:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int mfcr2_progress_sent:1;</span><br><span> #endif /* defined(HAVE_OPENR2) */</span><br><span> /*! \brief DTMF digit in progress. 0 when no digit in progress. */</span><br><span> char begindigit;</span><br><span>diff --git a/channels/chan_motif.c b/channels/chan_motif.c</span><br><span>index a9dd2af..9315134 100644</span><br><span>--- a/channels/chan_motif.c</span><br><span>+++ b/channels/chan_motif.c</span><br><span>@@ -2086,15 +2086,16 @@</span><br><span> </span><br><span> /* Iterate the codecs updating the relevant RTP instance as we go */</span><br><span> for (codec = iks_child(description); codec; codec = iks_next(codec)) {</span><br><span style="color: hsl(0, 100%, 40%);">- char *id = iks_find_attrib(codec, "id"), *name = iks_find_attrib(codec, "name");</span><br><span style="color: hsl(120, 100%, 40%);">+ char *id = iks_find_attrib(codec, "id");</span><br><span style="color: hsl(120, 100%, 40%);">+ char *attr_name = iks_find_attrib(codec, "name");</span><br><span> char *clockrate = iks_find_attrib(codec, "clockrate");</span><br><span> int rtp_id, rtp_clockrate;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(id) && !ast_strlen_zero(name) && (sscanf(id, "%30d", &rtp_id) == 1)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_strlen_zero(id) && !ast_strlen_zero(attr_name) && (sscanf(id, "%30d", &rtp_id) == 1)) {</span><br><span> if (!ast_strlen_zero(clockrate) && (sscanf(clockrate, "%30d", &rtp_clockrate) == 1)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_rtp_codecs_payloads_set_rtpmap_type_rate(&codecs, NULL, rtp_id, media, name, 0, rtp_clockrate);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_rtp_codecs_payloads_set_rtpmap_type_rate(&codecs, NULL, rtp_id, media, attr_name, 0, rtp_clockrate);</span><br><span> } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_rtp_codecs_payloads_set_rtpmap_type(&codecs, NULL, rtp_id, media, name, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_rtp_codecs_payloads_set_rtpmap_type(&codecs, NULL, rtp_id, media, attr_name, 0);</span><br><span> }</span><br><span> }</span><br><span> }</span><br><span>diff --git a/codecs/ex_alaw.h b/codecs/ex_alaw.h</span><br><span>index e8629be..6eeeab2 100644</span><br><span>--- a/codecs/ex_alaw.h</span><br><span>+++ b/codecs/ex_alaw.h</span><br><span>@@ -7,6 +7,9 @@</span><br><span> *</span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_EX_ALAW_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_EX_ALAW_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static uint8_t ex_alaw[] = {</span><br><span> 0x00, 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12, 0x15,</span><br><span> 0x10, 0x18, 0x1b, 0x1e, 0x21, 0x24, 0x27, 0x2a,</span><br><span>@@ -34,3 +37,5 @@</span><br><span> f.subclass.format = ast_format_alaw;</span><br><span> return &f;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_EX_ALAW_H */</span><br><span>diff --git a/codecs/ex_g722.h b/codecs/ex_g722.h</span><br><span>index 390cc7b..43f1f18 100644</span><br><span>--- a/codecs/ex_g722.h</span><br><span>+++ b/codecs/ex_g722.h</span><br><span>@@ -7,6 +7,9 @@</span><br><span> *</span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_EX_G722_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_EX_G722_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static uint8_t ex_g722[] = {</span><br><span> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,</span><br><span> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,</span><br><span>@@ -46,3 +49,5 @@</span><br><span> </span><br><span> return &f;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_EX_G722_H */</span><br><span>diff --git a/codecs/ex_ulaw.h b/codecs/ex_ulaw.h</span><br><span>index d18a08e..07bd100 100644</span><br><span>--- a/codecs/ex_ulaw.h</span><br><span>+++ b/codecs/ex_ulaw.h</span><br><span>@@ -7,6 +7,9 @@</span><br><span> *</span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_EX_ULAW_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_EX_ULAW_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static uint8_t ex_ulaw[] = {</span><br><span> 0x00, 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12, 0x15,</span><br><span> 0x10, 0x18, 0x1b, 0x1e, 0x21, 0x24, 0x27, 0x2a,</span><br><span>@@ -36,3 +39,5 @@</span><br><span> </span><br><span> return &f;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_EX_ULAW_H */</span><br><span>diff --git a/formats/format_g726.c b/formats/format_g726.c</span><br><span>index 934f9c3..c38944a 100644</span><br><span>--- a/formats/format_g726.c</span><br><span>+++ b/formats/format_g726.c</span><br><span>@@ -199,7 +199,7 @@</span><br><span> return ftello(fs->f) << 1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_format_def f[] = {</span><br><span style="color: hsl(120, 100%, 40%);">+static struct ast_format_def f_def[] = {</span><br><span> {</span><br><span> .name = "g726-40",</span><br><span> .exts = "g726-40",</span><br><span>@@ -259,9 +259,9 @@</span><br><span> {</span><br><span> int i;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- for (i = 0; f[i].desc_size ; i++) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_format_def_unregister(f[i].name))</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Failed to unregister format %s.\n", f[i].name);</span><br><span style="color: hsl(120, 100%, 40%);">+ for (i = 0; f_def[i].desc_size ; i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_format_def_unregister(f_def[i].name))</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Failed to unregister format %s.\n", f_def[i].name);</span><br><span> }</span><br><span> return(0);</span><br><span> }</span><br><span>@@ -270,10 +270,10 @@</span><br><span> {</span><br><span> int i;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- for (i = 0; f[i].desc_size ; i++) {</span><br><span style="color: hsl(0, 100%, 40%);">- f[i].format = ast_format_g726;</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_format_def_register(&f[i])) { /* errors are fatal */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Failed to register format %s.\n", f[i].name);</span><br><span style="color: hsl(120, 100%, 40%);">+ for (i = 0; f_def[i].desc_size ; i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ f_def[i].format = ast_format_g726;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_format_def_register(&f_def[i])) { /* errors are fatal */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Failed to register format %s.\n", f_def[i].name);</span><br><span> unload_module();</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span>diff --git a/formats/msgsm.h b/formats/msgsm.h</span><br><span>index bb46a3a..179d6e8 100644</span><br><span>--- a/formats/msgsm.h</span><br><span>+++ b/formats/msgsm.h</span><br><span>@@ -1,4 +1,6 @@</span><br><span> /* Conversion routines derived from code by guido@sienanet.it */</span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_MSGSM_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_MSGSM_H</span><br><span> </span><br><span> #define GSM_MAGIC 0xD</span><br><span> </span><br><span>@@ -687,3 +689,5 @@</span><br><span> writeGSM_33(d+33);</span><br><span> </span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_MSGSM_H */</span><br><span>diff --git a/include/asterisk/ari.h b/include/asterisk/ari.h</span><br><span>index 865b4b0..17464c0 100644</span><br><span>--- a/include/asterisk/ari.h</span><br><span>+++ b/include/asterisk/ari.h</span><br><span>@@ -101,7 +101,7 @@</span><br><span> /*! Corresponding text for the response code */</span><br><span> const char *response_text; /* Shouldn't http.c handle this? */</span><br><span> /*! Flag to indicate that no further response is needed */</span><br><span style="color: hsl(0, 100%, 40%);">- int no_response:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int no_response:1;</span><br><span> };</span><br><span> </span><br><span> /*!</span><br><span>diff --git a/include/asterisk/calendar.h b/include/asterisk/calendar.h</span><br><span>index bfc7c6b..79d33fc 100644</span><br><span>--- a/include/asterisk/calendar.h</span><br><span>+++ b/include/asterisk/calendar.h</span><br><span>@@ -133,8 +133,8 @@</span><br><span> int timeframe; /*!< Span (in mins) of calendar data to pull with each request */</span><br><span> pthread_t thread; /*!< The thread that the calendar is loaded/updated in */</span><br><span> ast_cond_t unload;</span><br><span style="color: hsl(0, 100%, 40%);">- int unloading:1;</span><br><span style="color: hsl(0, 100%, 40%);">- int pending_deletion:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int unloading:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int pending_deletion:1;</span><br><span> struct ao2_container *events; /*!< The events that are known at this time */</span><br><span> };</span><br><span> </span><br><span>diff --git a/include/asterisk/channel_internal.h b/include/asterisk/channel_internal.h</span><br><span>index dd791a4..774c9b0 100644</span><br><span>--- a/include/asterisk/channel_internal.h</span><br><span>+++ b/include/asterisk/channel_internal.h</span><br><span>@@ -18,6 +18,9 @@</span><br><span> * \brief Internal channel functions for channel.c to use</span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_CHANNEL_INTERNAL_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_CHANNEL_INTERNAL_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #define ast_channel_internal_alloc(destructor, assignedid, requestor) __ast_channel_internal_alloc(destructor, assignedid, requestor, __FILE__, __LINE__, __PRETTY_FUNCTION__)</span><br><span> struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj), const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *file, int line, const char *function);</span><br><span> void ast_channel_internal_finalize(struct ast_channel *chan);</span><br><span>@@ -33,3 +36,5 @@</span><br><span> struct ast_channel *chan, void *change_source);</span><br><span> void ast_channel_internal_swap_stream_topology(struct ast_channel *chan1,</span><br><span> struct ast_channel *chan2);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_CHANNEL_INTERNAL_H */</span><br><span>diff --git a/include/asterisk/config_options.h b/include/asterisk/config_options.h</span><br><span>index 420eb97..4429936 100644</span><br><span>--- a/include/asterisk/config_options.h</span><br><span>+++ b/include/asterisk/config_options.h</span><br><span>@@ -168,7 +168,7 @@</span><br><span> </span><br><span> struct aco_info {</span><br><span> const char *module; /*!< The name of the module whose config is being processed */</span><br><span style="color: hsl(0, 100%, 40%);">- int hidden:1; /*!< If enabled, this config item is hidden from users */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int hidden:1; /*!< If enabled, this config item is hidden from users */</span><br><span> aco_pre_apply_config pre_apply_config; /*!< A callback called after processing, but before changes are applied */</span><br><span> aco_post_apply_config post_apply_config;/*!< A callback called after changes are applied */</span><br><span> aco_snapshot_alloc snapshot_alloc; /*!< Allocate an object to hold all global configs and item containers */</span><br><span>diff --git a/include/asterisk/dns_internal.h b/include/asterisk/dns_internal.h</span><br><span>index d517748..7ce0c28 100644</span><br><span>--- a/include/asterisk/dns_internal.h</span><br><span>+++ b/include/asterisk/dns_internal.h</span><br><span>@@ -23,6 +23,9 @@</span><br><span> * \author Joshua Colp <jcolp@digium.com></span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef _ASTERISK_DNS_INTERNAL_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define _ASTERISK_DNS_INTERNAL_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \brief For AST_VECTOR */</span><br><span> #include "asterisk/vector.h"</span><br><span> </span><br><span>@@ -293,3 +296,5 @@</span><br><span> * \note The query must be released upon completion or cancellation using ao2_ref</span><br><span> */</span><br><span> struct ast_dns_query *dns_query_alloc(const char *name, int rr_type, int rr_class, ast_dns_resolve_callback callback, void *data);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* _ASTERISK_DNS_INTERNAL_H */</span><br><span>diff --git a/include/asterisk/max_forwards.h b/include/asterisk/max_forwards.h</span><br><span>index 3130b4b..5d0c0d8 100644</span><br><span>--- a/include/asterisk/max_forwards.h</span><br><span>+++ b/include/asterisk/max_forwards.h</span><br><span>@@ -17,6 +17,7 @@</span><br><span> */</span><br><span> </span><br><span> #ifndef MAX_FORWARDS_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define MAX_FORWARDS_H</span><br><span> </span><br><span> struct ast_channel;</span><br><span> </span><br><span>diff --git a/include/asterisk/mixmonitor.h b/include/asterisk/mixmonitor.h</span><br><span>index 892cd2a..3cf4f1c 100644</span><br><span>--- a/include/asterisk/mixmonitor.h</span><br><span>+++ b/include/asterisk/mixmonitor.h</span><br><span>@@ -23,6 +23,9 @@</span><br><span> * \author Jonathan Rose <jrose@digium.com></span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_MIX_MONITOR_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_MIX_MONITOR_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*!</span><br><span> * \brief Start a mixmonitor on a channel.</span><br><span> * \since 12.0.0</span><br><span>@@ -103,3 +106,5 @@</span><br><span> * \retval non-zero on failure</span><br><span> */</span><br><span> int ast_stop_mixmonitor(struct ast_channel *chan, const char *mixmon_id);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_MIX_MONITOR_H */</span><br><span>diff --git a/include/asterisk/parking.h b/include/asterisk/parking.h</span><br><span>index 554c8d5..512b1da 100644</span><br><span>--- a/include/asterisk/parking.h</span><br><span>+++ b/include/asterisk/parking.h</span><br><span>@@ -23,6 +23,9 @@</span><br><span> * \author Jonathan Rose <jrose@digium.com></span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_PARKING_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_PARKING_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #include "asterisk/stringfields.h"</span><br><span> #include "asterisk/bridge.h"</span><br><span> </span><br><span>@@ -294,3 +297,5 @@</span><br><span> * \retval 1 if there is a parking provider regsistered</span><br><span> */</span><br><span> int ast_parking_provider_registered(void);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_PARKING_H */</span><br><span>diff --git a/include/asterisk/res_pjsip_presence_xml.h b/include/asterisk/res_pjsip_presence_xml.h</span><br><span>index 55b79ad..60235ca 100644</span><br><span>--- a/include/asterisk/res_pjsip_presence_xml.h</span><br><span>+++ b/include/asterisk/res_pjsip_presence_xml.h</span><br><span>@@ -30,6 +30,9 @@</span><br><span> * This constant is useful to check against when trying to determine</span><br><span> * if printing XML succeeded or failed.</span><br><span> */</span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_PJSIP_PRESENCE_XML_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_PJSIP_PRESENCE_XML_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #define AST_PJSIP_XML_PROLOG_LEN 39</span><br><span> </span><br><span> /*!</span><br><span>@@ -115,3 +118,5 @@</span><br><span> void ast_sip_presence_xml_find_node_attr(pj_pool_t* pool,</span><br><span> pj_xml_node *parent, const char *node_name, const char *attr_name,</span><br><span> pj_xml_node **node, pj_xml_attr **attr);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_PJSIP_PRESENCE_XML_H */</span><br><span>diff --git a/include/asterisk/slin.h b/include/asterisk/slin.h</span><br><span>index 9766374..5d290cd 100644</span><br><span>--- a/include/asterisk/slin.h</span><br><span>+++ b/include/asterisk/slin.h</span><br><span>@@ -22,6 +22,9 @@</span><br><span> * Samples were truncated at 160 and 320 bytes.</span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_SLIN_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_SLIN_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static uint16_t ex_slin8[] = {</span><br><span> 0x0002, 0xfffc, 0x0000, 0xfffe, 0x0000, 0xfffa, 0x002a, 0x007a,</span><br><span> 0x003a, 0xffbe, 0xff76, 0xff84, 0x0016, 0x007e, 0x0096, 0x00d2,</span><br><span>@@ -91,3 +94,5 @@</span><br><span> </span><br><span> return &f;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_SLIN_H */</span><br><span>diff --git a/main/app.c b/main/app.c</span><br><span>index 701bbd8..ae3f416 100644</span><br><span>--- a/main/app.c</span><br><span>+++ b/main/app.c</span><br><span>@@ -1504,7 +1504,7 @@</span><br><span> char comment[256];</span><br><span> int x, fmtcnt = 1, res = -1, outmsg = 0;</span><br><span> struct ast_filestream *others[AST_MAX_FORMATS];</span><br><span style="color: hsl(0, 100%, 40%);">- char *sfmt[AST_MAX_FORMATS];</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *sfmt[AST_MAX_FORMATS];</span><br><span> char *stringp = NULL;</span><br><span> time_t start, end;</span><br><span> struct ast_dsp *sildet = NULL; /* silence detector dsp */</span><br><span>@@ -1579,7 +1579,12 @@</span><br><span> ast_log(LOG_WARNING, "Please increase AST_MAX_FORMATS in file.h\n");</span><br><span> break;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- sfmt[fmtcnt++] = ast_strdupa(fmt);</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Storage for 'fmt' is on the stack and held by 'fmts', which is maintained for</span><br><span style="color: hsl(120, 100%, 40%);">+ * the rest of this function. So okay to not duplicate 'fmt' here, but only keep</span><br><span style="color: hsl(120, 100%, 40%);">+ * a pointer to it.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ sfmt[fmtcnt++] = fmt;</span><br><span> }</span><br><span> </span><br><span> end = start = time(NULL); /* pre-initialize end to be same as start in case we never get into loop */</span><br><span>diff --git a/main/asterisk.c b/main/asterisk.c</span><br><span>index 737f0d0..dd2ae6f 100644</span><br><span>--- a/main/asterisk.c</span><br><span>+++ b/main/asterisk.c</span><br><span>@@ -3491,10 +3491,11 @@</span><br><span> int main(int argc, char *argv[])</span><br><span> {</span><br><span> int c;</span><br><span style="color: hsl(0, 100%, 40%);">- char * xarg = NULL;</span><br><span> int x;</span><br><span> int isroot = 1, rundir_exists = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *runuser = NULL, *rungroup = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(char *, runuser, NULL, ast_free);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(char *, rungroup, NULL, ast_free);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(char *, xarg, NULL, ast_free);</span><br><span> struct rlimit l;</span><br><span> static const char *getopt_settings = "BC:cde:FfG:ghIiL:M:mnpqRrs:TtU:VvWXx:";</span><br><span> </span><br><span>@@ -3599,7 +3600,7 @@</span><br><span> break;</span><br><span> #endif</span><br><span> case 'G':</span><br><span style="color: hsl(0, 100%, 40%);">- rungroup = ast_strdupa(optarg);</span><br><span style="color: hsl(120, 100%, 40%);">+ rungroup = ast_strdup(optarg);</span><br><span> break;</span><br><span> case 'g':</span><br><span> ast_set_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE);</span><br><span>@@ -3655,7 +3656,7 @@</span><br><span> ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES);</span><br><span> break;</span><br><span> case 'U':</span><br><span style="color: hsl(0, 100%, 40%);">- runuser = ast_strdupa(optarg);</span><br><span style="color: hsl(120, 100%, 40%);">+ runuser = ast_strdup(optarg);</span><br><span> break;</span><br><span> case 'V':</span><br><span> case 'v':</span><br><span>@@ -3670,7 +3671,7 @@</span><br><span> ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);</span><br><span> </span><br><span> ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC | AST_OPT_FLAG_NO_COLOR);</span><br><span style="color: hsl(0, 100%, 40%);">- xarg = ast_strdupa(optarg);</span><br><span style="color: hsl(120, 100%, 40%);">+ xarg = ast_strdup(optarg);</span><br><span> break;</span><br><span> case '?':</span><br><span> /* already processed. */</span><br><span>@@ -3749,9 +3750,9 @@</span><br><span> #endif /* !defined(CONFIGURE_RAN_AS_ROOT) */</span><br><span> </span><br><span> if ((!rungroup) && !ast_strlen_zero(ast_config_AST_RUN_GROUP))</span><br><span style="color: hsl(0, 100%, 40%);">- rungroup = ast_config_AST_RUN_GROUP;</span><br><span style="color: hsl(120, 100%, 40%);">+ rungroup = ast_strdup(ast_config_AST_RUN_GROUP);</span><br><span> if ((!runuser) && !ast_strlen_zero(ast_config_AST_RUN_USER))</span><br><span style="color: hsl(0, 100%, 40%);">- runuser = ast_config_AST_RUN_USER;</span><br><span style="color: hsl(120, 100%, 40%);">+ runuser = ast_strdup(ast_config_AST_RUN_USER);</span><br><span> </span><br><span> /* Must install this signal handler up here to ensure that if the canary</span><br><span> * fails to execute that it doesn't kill the Asterisk process.</span><br><span>diff --git a/main/event.c b/main/event.c</span><br><span>index 1e623a1..2b73cd7 100644</span><br><span>--- a/main/event.c</span><br><span>+++ b/main/event.c</span><br><span>@@ -419,7 +419,7 @@</span><br><span> ie_type != AST_EVENT_IE_END;</span><br><span> ie_type = va_arg(ap, enum ast_event_ie_type))</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_event_ie_val *ie_value = ast_alloca(sizeof(*ie_value));</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_event_ie_val *ie_value = ast_malloc(sizeof(*ie_value));</span><br><span> int insert = 0;</span><br><span> </span><br><span> memset(ie_value, 0, sizeof(*ie_value));</span><br><span>@@ -443,7 +443,7 @@</span><br><span> {</span><br><span> void *data = va_arg(ap, void *);</span><br><span> size_t datalen = va_arg(ap, size_t);</span><br><span style="color: hsl(0, 100%, 40%);">- ie_value->payload.raw = ast_alloca(datalen);</span><br><span style="color: hsl(120, 100%, 40%);">+ ie_value->payload.raw = ast_malloc(datalen);</span><br><span> memcpy(ie_value->payload.raw, data, datalen);</span><br><span> ie_value->raw_datalen = datalen;</span><br><span> insert = 1;</span><br><span>@@ -491,7 +491,7 @@</span><br><span> </span><br><span> /* realloc inside one of the append functions failed */</span><br><span> if (!event) {</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ goto cleanup;</span><br><span> }</span><br><span> }</span><br><span> </span><br><span>@@ -501,6 +501,17 @@</span><br><span> ast_event_append_eid(&event);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+cleanup:</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_LIST_TRAVERSE_SAFE_BEGIN(&ie_vals, ie_val, entry) {</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_LIST_REMOVE_CURRENT(entry);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(ie_val->payload.raw);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(ie_val);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_LIST_TRAVERSE_SAFE_END;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> return event;</span><br><span> }</span><br><span> </span><br><span>diff --git a/main/file.c b/main/file.c</span><br><span>index 3ee58b1..9896c7e 100644</span><br><span>--- a/main/file.c</span><br><span>+++ b/main/file.c</span><br><span>@@ -517,7 +517,9 @@</span><br><span> AST_RWLIST_RDLOCK(&formats);</span><br><span> /* Check for a specific format */</span><br><span> AST_RWLIST_TRAVERSE(&formats, f, list) {</span><br><span style="color: hsl(0, 100%, 40%);">- char *stringp, *ext = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *ext = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ char storage[strlen(f->exts) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+ char *stringp;</span><br><span> </span><br><span> if (fmt && !exts_compare(f->exts, fmt))</span><br><span> continue;</span><br><span>@@ -526,7 +528,8 @@</span><br><span> * The file must exist, and for OPEN, must match</span><br><span> * one of the formats supported by the channel.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">- stringp = ast_strdupa(f->exts); /* this is in the stack so does not need to be freed */</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(storage, f->exts); /* safe - this is in the stack so does not need to be freed */</span><br><span style="color: hsl(120, 100%, 40%);">+ stringp = storage;</span><br><span> while ( (ext = strsep(&stringp, "|")) ) {</span><br><span> struct stat st;</span><br><span> char *fn = build_filename(filename, ext);</span><br><span>@@ -1407,13 +1410,13 @@</span><br><span> We touch orig_fn just as a place-holder so other things (like vmail) see the file is there.</span><br><span> What we are really doing is writing to record_cache_dir until we are done then we will mv the file into place.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">- orig_fn = ast_strdupa(fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ orig_fn = ast_strdup(fn);</span><br><span> for (c = fn; *c; c++)</span><br><span> if (*c == '/')</span><br><span> *c = '_';</span><br><span> </span><br><span> size = strlen(fn) + strlen(record_cache_dir) + 2;</span><br><span style="color: hsl(0, 100%, 40%);">- buf = ast_alloca(size);</span><br><span style="color: hsl(120, 100%, 40%);">+ buf = ast_malloc(size);</span><br><span> strcpy(buf, record_cache_dir);</span><br><span> strcat(buf, "/");</span><br><span> strcat(buf, fn);</span><br><span>@@ -1444,14 +1447,18 @@</span><br><span> if (orig_fn) {</span><br><span> unlink(fn);</span><br><span> unlink(orig_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(orig_fn);</span><br><span> }</span><br><span> if (fs) {</span><br><span> ast_closestream(fs);</span><br><span> fs = NULL;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!buf) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(fn);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * 'fn' was has either been allocated from build_filename, or that was freed</span><br><span style="color: hsl(120, 100%, 40%);">+ * and now 'fn' points to memory allocated for 'buf'. Either way the memory</span><br><span style="color: hsl(120, 100%, 40%);">+ * now needs to be released.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(fn);</span><br><span> continue;</span><br><span> }</span><br><span> fs->trans = NULL;</span><br><span>@@ -1459,8 +1466,14 @@</span><br><span> fs->flags = flags;</span><br><span> fs->mode = mode;</span><br><span> if (orig_fn) {</span><br><span style="color: hsl(0, 100%, 40%);">- fs->realfilename = ast_strdup(orig_fn);</span><br><span style="color: hsl(0, 100%, 40%);">- fs->filename = ast_strdup(fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ fs->realfilename = orig_fn;</span><br><span style="color: hsl(120, 100%, 40%);">+ fs->filename = fn;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * The above now manages the memory allocated for 'orig_fn' and 'fn', so</span><br><span style="color: hsl(120, 100%, 40%);">+ * set them to NULL, so they don't get released at the end of the loop.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ orig_fn = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ fn = NULL;</span><br><span> } else {</span><br><span> fs->realfilename = NULL;</span><br><span> fs->filename = ast_strdup(filename);</span><br><span>@@ -1473,9 +1486,9 @@</span><br><span> if (orig_fn)</span><br><span> unlink(orig_fn);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- /* if buf != NULL then fn is already free and pointing to it */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!buf)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Free 'fn', or if 'fn' points to 'buf' then free 'buf' */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(orig_fn);</span><br><span> }</span><br><span> </span><br><span> AST_RWLIST_UNLOCK(&formats);</span><br><span>diff --git a/main/indications.c b/main/indications.c</span><br><span>index c074844..88cd7b4 100644</span><br><span>--- a/main/indications.c</span><br><span>+++ b/main/indications.c</span><br><span>@@ -904,11 +904,11 @@</span><br><span> ast_copy_string(buf, val, sizeof(buf));</span><br><span> </span><br><span> while ((ring = strsep(&c, ","))) {</span><br><span style="color: hsl(0, 100%, 40%);">- int *tmp, val;</span><br><span style="color: hsl(120, 100%, 40%);">+ int *tmp, value;</span><br><span> </span><br><span> ring = ast_strip(ring);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!isdigit(ring[0]) || (val = atoi(ring)) == -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!isdigit(ring[0]) || (value = atoi(ring)) == -1) {</span><br><span> ast_log(LOG_WARNING, "Invalid ringcadence given '%s'.\n", ring);</span><br><span> continue;</span><br><span> }</span><br><span>@@ -918,7 +918,7 @@</span><br><span> }</span><br><span> </span><br><span> zone->ringcadence = tmp;</span><br><span style="color: hsl(0, 100%, 40%);">- tmp[zone->nrringcadence] = val;</span><br><span style="color: hsl(120, 100%, 40%);">+ tmp[zone->nrringcadence] = value;</span><br><span> zone->nrringcadence++;</span><br><span> }</span><br><span> }</span><br><span>diff --git a/main/manager.c b/main/manager.c</span><br><span>index 904ae1f..dd099c5 100644</span><br><span>--- a/main/manager.c</span><br><span>+++ b/main/manager.c</span><br><span>@@ -1619,7 +1619,7 @@</span><br><span> struct ast_iostream *stream;</span><br><span> struct ast_tcptls_session_instance *tcptls_session;</span><br><span> enum mansession_message_parsing parsing;</span><br><span style="color: hsl(0, 100%, 40%);">- int write_error:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int write_error:1;</span><br><span> struct manager_custom_hook *hook;</span><br><span> ast_mutex_t lock;</span><br><span> };</span><br><span>@@ -3820,8 +3820,8 @@</span><br><span> int allowdups = 0;</span><br><span> int istemplate = 0;</span><br><span> int ignoreerror = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- char *inherit = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- char *catfilter = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(char *, inherit, NULL, ast_free);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(char *, catfilter, NULL, ast_free);</span><br><span> char *token;</span><br><span> int foundvar = 0;</span><br><span> int foundcat = 0;</span><br><span>@@ -3859,7 +3859,9 @@</span><br><span> snprintf(hdr, sizeof(hdr), "Options-%06d", x);</span><br><span> options = astman_get_header(m, hdr);</span><br><span> if (!ast_strlen_zero(options)) {</span><br><span style="color: hsl(0, 100%, 40%);">- dupoptions = ast_strdupa(options);</span><br><span style="color: hsl(120, 100%, 40%);">+ char copy[strlen(options) + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(copy, options); /* safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ dupoptions = copy;</span><br><span> while ((token = ast_strsep(&dupoptions, ',', AST_STRSEP_STRIP))) {</span><br><span> if (!strcasecmp("allowdups", token)) {</span><br><span> allowdups = 1;</span><br><span>@@ -3877,7 +3879,7 @@</span><br><span> char *c = ast_strsep(&token, '=', AST_STRSEP_STRIP);</span><br><span> c = ast_strsep(&token, '=', AST_STRSEP_STRIP);</span><br><span> if (c) {</span><br><span style="color: hsl(0, 100%, 40%);">- inherit = ast_strdupa(c);</span><br><span style="color: hsl(120, 100%, 40%);">+ inherit = ast_strdup(c);</span><br><span> }</span><br><span> continue;</span><br><span> }</span><br><span>@@ -3885,7 +3887,7 @@</span><br><span> char *c = ast_strsep(&token, '=', AST_STRSEP_STRIP);</span><br><span> c = ast_strsep(&token, '=', AST_STRSEP_STRIP);</span><br><span> if (c) {</span><br><span style="color: hsl(0, 100%, 40%);">- catfilter = ast_strdupa(c);</span><br><span style="color: hsl(120, 100%, 40%);">+ catfilter = ast_strdup(c);</span><br><span> }</span><br><span> continue;</span><br><span> }</span><br><span>diff --git a/main/pbx_variables.c b/main/pbx_variables.c</span><br><span>index 1dc0fc0..c1463d0 100644</span><br><span>--- a/main/pbx_variables.c</span><br><span>+++ b/main/pbx_variables.c</span><br><span>@@ -630,9 +630,8 @@</span><br><span> /* Substitutes variables into cp2, based on string cp1, cp2 NO LONGER NEEDS TO BE ZEROED OUT!!!! */</span><br><span> const char *whereweare;</span><br><span> const char *orig_cp2 = cp2;</span><br><span style="color: hsl(0, 100%, 40%);">- char *workspace = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- char *ltmp = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- char *var = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ char ltmp[VAR_BUF_SIZE];</span><br><span style="color: hsl(120, 100%, 40%);">+ char var[VAR_BUF_SIZE];</span><br><span> </span><br><span> *cp2 = 0; /* just in case nothing ends up there */</span><br><span> whereweare = cp1;</span><br><span>@@ -690,6 +689,7 @@</span><br><span> int offset2;</span><br><span> int isfunction;</span><br><span> char *cp4;</span><br><span style="color: hsl(120, 100%, 40%);">+ char workspace[VAR_BUF_SIZE] = "";</span><br><span> </span><br><span> /* We have a variable. Find the start and end, and determine</span><br><span> if we are going to have to recursively call ourselves on the</span><br><span>@@ -725,28 +725,17 @@</span><br><span> /* Skip totally over variable string */</span><br><span> whereweare = vare;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!var)</span><br><span style="color: hsl(0, 100%, 40%);">- var = ast_alloca(VAR_BUF_SIZE);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /* Store variable name expression to lookup (and truncate). */</span><br><span> ast_copy_string(var, vars, len + 1);</span><br><span> </span><br><span> /* Substitute if necessary */</span><br><span> if (needsub) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ltmp) {</span><br><span style="color: hsl(0, 100%, 40%);">- ltmp = ast_alloca(VAR_BUF_SIZE);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> pbx_substitute_variables_helper_full(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL);</span><br><span> vars = ltmp;</span><br><span> } else {</span><br><span> vars = var;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!workspace)</span><br><span style="color: hsl(0, 100%, 40%);">- workspace = ast_alloca(VAR_BUF_SIZE);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- workspace[0] = '\0';</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> parse_variable_name(vars, &offset, &offset2, &isfunction);</span><br><span> if (isfunction) {</span><br><span> /* Evaluate function */</span><br><span>@@ -820,17 +809,11 @@</span><br><span> /* Skip totally over expression */</span><br><span> whereweare = vare;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!var)</span><br><span style="color: hsl(0, 100%, 40%);">- var = ast_alloca(VAR_BUF_SIZE);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /* Store expression to evaluate (and truncate). */</span><br><span> ast_copy_string(var, vars, len + 1);</span><br><span> </span><br><span> /* Substitute if necessary */</span><br><span> if (needsub) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ltmp) {</span><br><span style="color: hsl(0, 100%, 40%);">- ltmp = ast_alloca(VAR_BUF_SIZE);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> pbx_substitute_variables_helper_full(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL);</span><br><span> vars = ltmp;</span><br><span> } else {</span><br><span>diff --git a/main/stasis.c b/main/stasis.c</span><br><span>index d7aafaa..9d7c11f 100644</span><br><span>--- a/main/stasis.c</span><br><span>+++ b/main/stasis.c</span><br><span>@@ -301,7 +301,7 @@</span><br><span> #define TOPIC_POOL_BUCKETS 57</span><br><span> </span><br><span> /*! Thread pool for topics that don't want a dedicated taskprocessor */</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_threadpool *pool;</span><br><span style="color: hsl(120, 100%, 40%);">+static struct ast_threadpool *threadpool;</span><br><span> </span><br><span> STASIS_MESSAGE_TYPE_DEFN(stasis_subscription_change_type);</span><br><span> </span><br><span>@@ -900,7 +900,7 @@</span><br><span> * pool should be used.</span><br><span> */</span><br><span> if (use_thread_pool) {</span><br><span style="color: hsl(0, 100%, 40%);">- sub->mailbox = ast_threadpool_serializer(tps_name, pool);</span><br><span style="color: hsl(120, 100%, 40%);">+ sub->mailbox = ast_threadpool_serializer(tps_name, threadpool);</span><br><span> } else {</span><br><span> sub->mailbox = ast_taskprocessor_get(tps_name, TPS_REF_DEFAULT);</span><br><span> }</span><br><span>@@ -3027,8 +3027,8 @@</span><br><span> ast_cli_unregister_multiple(cli_stasis, ARRAY_LEN(cli_stasis));</span><br><span> ao2_cleanup(topic_all);</span><br><span> topic_all = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_threadpool_shutdown(pool);</span><br><span style="color: hsl(0, 100%, 40%);">- pool = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_threadpool_shutdown(threadpool);</span><br><span style="color: hsl(120, 100%, 40%);">+ threadpool = NULL;</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(stasis_subscription_change_type);</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(ast_multi_user_event_type);</span><br><span> aco_info_destroy(&cfg_info);</span><br><span>@@ -3105,9 +3105,9 @@</span><br><span> threadpool_opts.auto_increment = 1;</span><br><span> threadpool_opts.max_size = cfg->threadpool_options->max_size;</span><br><span> threadpool_opts.idle_timeout = cfg->threadpool_options->idle_timeout_sec;</span><br><span style="color: hsl(0, 100%, 40%);">- pool = ast_threadpool_create("stasis", NULL, &threadpool_opts);</span><br><span style="color: hsl(120, 100%, 40%);">+ threadpool = ast_threadpool_create("stasis", NULL, &threadpool_opts);</span><br><span> ao2_ref(cfg, -1);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!pool) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!threadpool) {</span><br><span> ast_log(LOG_ERROR, "Failed to create 'stasis-core' threadpool\n");</span><br><span> </span><br><span> return -1;</span><br><span>diff --git a/main/stasis_cache.c b/main/stasis_cache.c</span><br><span>index bcd7e7d..51b2c5a 100644</span><br><span>--- a/main/stasis_cache.c</span><br><span>+++ b/main/stasis_cache.c</span><br><span>@@ -863,13 +863,13 @@</span><br><span> * continue to grow unabated.</span><br><span> */</span><br><span> if (strcmp(change->description, "Unsubscribe") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct stasis_cache_entry *sub;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct stasis_cache_entry *cached_sub;</span><br><span> </span><br><span> ao2_wrlock(caching_topic->cache->entries);</span><br><span style="color: hsl(0, 100%, 40%);">- sub = cache_find(caching_topic->cache->entries, stasis_subscription_change_type(), change->uniqueid);</span><br><span style="color: hsl(0, 100%, 40%);">- if (sub) {</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(cache_remove(caching_topic->cache->entries, sub, stasis_message_eid(message)));</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(sub);</span><br><span style="color: hsl(120, 100%, 40%);">+ cached_sub = cache_find(caching_topic->cache->entries, stasis_subscription_change_type(), change->uniqueid);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (cached_sub) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_cleanup(cache_remove(caching_topic->cache->entries, cached_sub, stasis_message_eid(message)));</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_cleanup(cached_sub);</span><br><span> }</span><br><span> ao2_unlock(caching_topic->cache->entries);</span><br><span> ao2_cleanup(caching_topic_needs_unref);</span><br><span>diff --git a/res/ari/config.c b/res/ari/config.c</span><br><span>index 46d23c6..501487f 100644</span><br><span>--- a/res/ari/config.c</span><br><span>+++ b/res/ari/config.c</span><br><span>@@ -165,7 +165,7 @@</span><br><span> .item_offset = offsetof(struct ast_ari_conf, users),</span><br><span> };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static struct aco_type *user[] = ACO_TYPES(&user_option);</span><br><span style="color: hsl(120, 100%, 40%);">+static struct aco_type *global_user[] = ACO_TYPES(&user_option);</span><br><span> </span><br><span> static void conf_general_dtor(void *obj)</span><br><span> {</span><br><span>@@ -361,16 +361,16 @@</span><br><span> "", channelvars_handler, 0);</span><br><span> </span><br><span> /* ARI type=user category options */</span><br><span style="color: hsl(0, 100%, 40%);">- aco_option_register(&cfg_info, "type", ACO_EXACT, user, NULL,</span><br><span style="color: hsl(120, 100%, 40%);">+ aco_option_register(&cfg_info, "type", ACO_EXACT, global_user, NULL,</span><br><span> OPT_NOOP_T, 0, 0);</span><br><span style="color: hsl(0, 100%, 40%);">- aco_option_register(&cfg_info, "read_only", ACO_EXACT, user,</span><br><span style="color: hsl(120, 100%, 40%);">+ aco_option_register(&cfg_info, "read_only", ACO_EXACT, global_user,</span><br><span> "no", OPT_BOOL_T, 1,</span><br><span> FLDSET(struct ast_ari_conf_user, read_only));</span><br><span style="color: hsl(0, 100%, 40%);">- aco_option_register(&cfg_info, "password", ACO_EXACT, user,</span><br><span style="color: hsl(120, 100%, 40%);">+ aco_option_register(&cfg_info, "password", ACO_EXACT, global_user,</span><br><span> "", OPT_CHAR_ARRAY_T, 0,</span><br><span> FLDSET(struct ast_ari_conf_user, password), ARI_PASSWORD_LEN);</span><br><span> aco_option_register_custom(&cfg_info, "password_format", ACO_EXACT,</span><br><span style="color: hsl(0, 100%, 40%);">- user, "plain", password_format_handler, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ global_user, "plain", password_format_handler, 0);</span><br><span> </span><br><span> return process_config(0);</span><br><span> }</span><br><span>diff --git a/res/parking/parking_bridge_features.c b/res/parking/parking_bridge_features.c</span><br><span>index d619471..d064991 100644</span><br><span>--- a/res/parking/parking_bridge_features.c</span><br><span>+++ b/res/parking/parking_bridge_features.c</span><br><span>@@ -69,7 +69,7 @@</span><br><span> struct parked_subscription_data {</span><br><span> struct transfer_channel_data *transfer_data;</span><br><span> char *parkee_uuid;</span><br><span style="color: hsl(0, 100%, 40%);">- int hangup_after:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int hangup_after:1;</span><br><span> char parker_uuid[0];</span><br><span> };</span><br><span> </span><br><span>diff --git a/res/parking/res_parking.h b/res/parking/res_parking.h</span><br><span>index 79fb97f..a1a5f49 100644</span><br><span>--- a/res/parking/res_parking.h</span><br><span>+++ b/res/parking/res_parking.h</span><br><span>@@ -23,6 +23,9 @@</span><br><span> * \author Jonathan Rose <jrose@digium.com></span><br><span> */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef ASTERISK_RES_PARKING_H</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASTERISK_RES_PARKING_H</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #include "asterisk/pbx.h"</span><br><span> #include "asterisk/bridge.h"</span><br><span> #include "asterisk/parking.h"</span><br><span>@@ -574,3 +577,5 @@</span><br><span> * \return Nothing</span><br><span> */</span><br><span> void unload_parking_tests(void);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* ASTERISK_RES_PARKING_H */</span><br><span>diff --git a/res/res_config_curl.c b/res/res_config_curl.c</span><br><span>index 03ff80c..bf960b9 100644</span><br><span>--- a/res/res_config_curl.c</span><br><span>+++ b/res/res_config_curl.c</span><br><span>@@ -156,7 +156,7 @@</span><br><span> for (field = fields; field; field = field->next) {</span><br><span> if (start) {</span><br><span> char *op;</span><br><span style="color: hsl(0, 100%, 40%);">- initfield = ast_strdupa(field->name);</span><br><span style="color: hsl(120, 100%, 40%);">+ initfield = ast_strdup(field->name);</span><br><span> if ((op = strchr(initfield, ' ')))</span><br><span> *op = '\0';</span><br><span> }</span><br><span>@@ -172,6 +172,7 @@</span><br><span> ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query));</span><br><span> </span><br><span> if (!(cfg = ast_config_new())) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(initfield);</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span>@@ -206,6 +207,8 @@</span><br><span> ast_category_append(cfg, cat);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(initfield);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> return cfg;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c</span><br><span>index 9b26ab2..ad74ae0 100644</span><br><span>--- a/res/res_phoneprov.c</span><br><span>+++ b/res/res_phoneprov.c</span><br><span>@@ -607,13 +607,14 @@</span><br><span> if (!strcasecmp(v->name, "mime_type")) {</span><br><span> ast_string_field_set(profile, default_mime_type, v->value);</span><br><span> } else if (!strcasecmp(v->name, "setvar")) {</span><br><span style="color: hsl(0, 100%, 40%);">- char *value_copy = ast_strdupa(v->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ char value_copy[strlen(v->value) + 1];</span><br><span> </span><br><span> AST_DECLARE_APP_ARGS(args,</span><br><span> AST_APP_ARG(varname);</span><br><span> AST_APP_ARG(varval);</span><br><span> );</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(value_copy, v->value); /* safe */</span><br><span> AST_NONSTANDARD_APP_ARGS(args, value_copy, '=');</span><br><span> do {</span><br><span> if (ast_strlen_zero(args.varname) || ast_strlen_zero(args.varval))</span><br><span>@@ -629,7 +630,7 @@</span><br><span> } else {</span><br><span> struct phoneprov_file *pp_file;</span><br><span> char *file_extension;</span><br><span style="color: hsl(0, 100%, 40%);">- char *value_copy = ast_strdupa(v->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ char value_copy[strlen(v->value) + 1];</span><br><span> </span><br><span> AST_DECLARE_APP_ARGS(args,</span><br><span> AST_APP_ARG(filename);</span><br><span>@@ -644,6 +645,7 @@</span><br><span> if ((file_extension = strrchr(pp_file->format, '.')))</span><br><span> file_extension++;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(value_copy, v->value); /* safe */</span><br><span> AST_STANDARD_APP_ARGS(args, value_copy);</span><br><span> </span><br><span> /* Mime type order of preference</span><br><span>diff --git a/res/res_pjsip/config_system.c b/res/res_pjsip/config_system.c</span><br><span>index 52f66a5..716a6da 100644</span><br><span>--- a/res/res_pjsip/config_system.c</span><br><span>+++ b/res/res_pjsip/config_system.c</span><br><span>@@ -83,7 +83,7 @@</span><br><span> return system;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int system_apply(const struct ast_sorcery *system_sorcery, void *obj)</span><br><span style="color: hsl(120, 100%, 40%);">+static int system_apply(const struct ast_sorcery *sorcery, void *obj)</span><br><span> {</span><br><span> struct system_config *system = obj;</span><br><span> int min_timerb;</span><br><span>diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c</span><br><span>index 404f513..ac2405b 100644</span><br><span>--- a/res/res_pjsip/config_transport.c</span><br><span>+++ b/res/res_pjsip/config_transport.c</span><br><span>@@ -1347,10 +1347,19 @@</span><br><span> return error;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void localnet_to_vl_append(struct ast_variable **head, struct ast_ha *ha)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ char str[MAX_OBJECT_FIELD];</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *addr = ast_strdupa(ast_sockaddr_stringify_addr(&ha->addr));</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(str, MAX_OBJECT_FIELD, "%s%s/%s", ha->sense == AST_SENSE_ALLOW ? "!" : "",</span><br><span style="color: hsl(120, 100%, 40%);">+ addr, ast_sockaddr_stringify_addr(&ha->netmask));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_variable_list_append(head, ast_variable_new("local_net", str, ""));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static int localnet_to_vl(const void *obj, struct ast_variable **fields)</span><br><span> {</span><br><span> const struct ast_sip_transport *transport = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- char str[MAX_OBJECT_FIELD];</span><br><span> struct ast_variable *head = NULL;</span><br><span> struct ast_ha *ha;</span><br><span> RAII_VAR(struct ast_sip_transport_state *, state, find_state_by_transport(transport), ao2_cleanup);</span><br><span>@@ -1360,11 +1369,7 @@</span><br><span> }</span><br><span> </span><br><span> for (ha = state->localnet; ha; ha = ha->next) {</span><br><span style="color: hsl(0, 100%, 40%);">- const char *addr = ast_strdupa(ast_sockaddr_stringify_addr(&ha->addr));</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(str, MAX_OBJECT_FIELD, "%s%s/%s", ha->sense == AST_SENSE_ALLOW ? "!" : "",</span><br><span style="color: hsl(0, 100%, 40%);">- addr, ast_sockaddr_stringify_addr(&ha->netmask));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_variable_list_append(&head, ast_variable_new("local_net", str, ""));</span><br><span style="color: hsl(120, 100%, 40%);">+ localnet_to_vl_append(&head, ha);</span><br><span> }</span><br><span> </span><br><span> if (head) {</span><br><span>diff --git a/res/res_pjsip/pjsip_resolver.c b/res/res_pjsip/pjsip_resolver.c</span><br><span>index b2e70f4..a7bd3ea 100644</span><br><span>--- a/res/res_pjsip/pjsip_resolver.c</span><br><span>+++ b/res/res_pjsip/pjsip_resolver.c</span><br><span>@@ -665,7 +665,7 @@</span><br><span> }</span><br><span> </span><br><span> /*! \brief External resolver implementation for PJSIP */</span><br><span style="color: hsl(0, 100%, 40%);">-static pjsip_ext_resolver resolver = {</span><br><span style="color: hsl(120, 100%, 40%);">+static pjsip_ext_resolver ext_resolver = {</span><br><span> .resolve = sip_resolve,</span><br><span> };</span><br><span> </span><br><span>@@ -697,7 +697,7 @@</span><br><span> pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);</span><br><span> </span><br><span> /* Replace the PJSIP resolver with our own implementation */</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_endpt_set_ext_resolver(ast_sip_get_pjsip_endpoint(), &resolver);</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_endpt_set_ext_resolver(ast_sip_get_pjsip_endpoint(), &ext_resolver);</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_pjsip_endpoint_identifier_ip.c b/res/res_pjsip_endpoint_identifier_ip.c</span><br><span>index 30b2a2e..a4bdab4 100644</span><br><span>--- a/res/res_pjsip_endpoint_identifier_ip.c</span><br><span>+++ b/res/res_pjsip_endpoint_identifier_ip.c</span><br><span>@@ -551,20 +551,24 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int match_to_var_list(const void *obj, struct ast_variable **fields)</span><br><span style="color: hsl(120, 100%, 40%);">+static void match_to_var_list_append(struct ast_variable **head, struct ast_ha *ha)</span><br><span> {</span><br><span> char str[MAX_OBJECT_FIELD];</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *addr = ast_strdupa(ast_sockaddr_stringify_addr(&ha->addr));</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(str, MAX_OBJECT_FIELD, "%s%s/%s", ha->sense == AST_SENSE_ALLOW ? "!" : "",</span><br><span style="color: hsl(120, 100%, 40%);">+ addr, ast_sockaddr_stringify_addr(&ha->netmask));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_variable_list_append(head, ast_variable_new("match", str, ""));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static int match_to_var_list(const void *obj, struct ast_variable **fields)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span> const struct ip_identify_match *identify = obj;</span><br><span> struct ast_variable *head = NULL;</span><br><span> struct ast_ha *ha = identify->matches;</span><br><span> </span><br><span> for (; ha; ha = ha->next) {</span><br><span style="color: hsl(0, 100%, 40%);">- const char *addr = ast_strdupa(ast_sockaddr_stringify_addr(&ha->addr));</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(str, MAX_OBJECT_FIELD, "%s%s/%s", ha->sense == AST_SENSE_ALLOW ? "!" : "",</span><br><span style="color: hsl(0, 100%, 40%);">- addr, ast_sockaddr_stringify_addr(&ha->netmask));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_variable_list_append(&head, ast_variable_new("match", str, ""));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+ match_to_var_list_append(&head, ha);</span><br><span> }</span><br><span> </span><br><span> if (head) {</span><br><span>diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c</span><br><span>index a17c06a..e043ead 100644</span><br><span>--- a/res/res_pjsip_registrar.c</span><br><span>+++ b/res/res_pjsip_registrar.c</span><br><span>@@ -1018,9 +1018,9 @@</span><br><span> case AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME:</span><br><span> uri = pjsip_uri_get_uri(rdata->msg_info.to->uri);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- domain_name = ast_alloca(uri->host.slen + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ domain_name = ast_malloc(uri->host.slen + 1);</span><br><span> ast_copy_pj_str(domain_name, &uri->host, uri->host.slen + 1);</span><br><span style="color: hsl(0, 100%, 40%);">- username = ast_alloca(uri->user.slen + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ username = ast_malloc(uri->user.slen + 1);</span><br><span> ast_copy_pj_str(username, &uri->user, uri->user.slen + 1);</span><br><span> </span><br><span> /*</span><br><span>@@ -1038,9 +1038,9 @@</span><br><span> while ((header = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_AUTHORIZATION,</span><br><span> header ? header->next : NULL))) {</span><br><span> if (header && !pj_stricmp2(&header->scheme, "digest")) {</span><br><span style="color: hsl(0, 100%, 40%);">- username = ast_alloca(header->credential.digest.username.slen + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ username = ast_malloc(header->credential.digest.username.slen + 1);</span><br><span> ast_copy_pj_str(username, &header->credential.digest.username, header->credential.digest.username.slen + 1);</span><br><span style="color: hsl(0, 100%, 40%);">- domain_name = ast_alloca(header->credential.digest.realm.slen + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ domain_name = ast_malloc(header->credential.digest.realm.slen + 1);</span><br><span> ast_copy_pj_str(domain_name, &header->credential.digest.realm, header->credential.digest.realm.slen + 1);</span><br><span> </span><br><span> aor_name = find_aor_name(username, domain_name, endpoint->aors);</span><br><span>@@ -1058,6 +1058,9 @@</span><br><span> if (aor_name) {</span><br><span> break;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(domain_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(username);</span><br><span> }</span><br><span> </span><br><span> if (ast_strlen_zero(aor_name) || !(aor = ast_sip_location_retrieve_aor(aor_name))) {</span><br><span>@@ -1068,6 +1071,8 @@</span><br><span> username ?: "", ast_sorcery_object_get_id(endpoint));</span><br><span> }</span><br><span> ast_free(aor_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(domain_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(username);</span><br><span> return aor;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c</span><br><span>index e5c6090..cb126a4 100644</span><br><span>--- a/res/res_pjsip_t38.c</span><br><span>+++ b/res/res_pjsip_t38.c</span><br><span>@@ -537,13 +537,13 @@</span><br><span> if (f->frametype == AST_FRAME_CONTROL</span><br><span> && f->subclass.integer == AST_CONTROL_T38_PARAMETERS) {</span><br><span> if (channel->session->endpoint->media.t38.enabled) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct t38_parameters_task_data *data;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct t38_parameters_task_data *task_data;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- data = t38_parameters_task_data_alloc(channel->session, f);</span><br><span style="color: hsl(0, 100%, 40%);">- if (data</span><br><span style="color: hsl(120, 100%, 40%);">+ task_data = t38_parameters_task_data_alloc(channel->session, f);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (task_data</span><br><span> && ast_sip_push_task(channel->session->serializer,</span><br><span style="color: hsl(0, 100%, 40%);">- t38_interpret_parameters, data)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_ref(data, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ t38_interpret_parameters, task_data)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(task_data, -1);</span><br><span> }</span><br><span> } else {</span><br><span> static const struct ast_control_t38_parameters rsp_refused = {</span><br><span>diff --git a/res/res_resolver_unbound.c b/res/res_resolver_unbound.c</span><br><span>index 7f3836a..93bb3ca 100644</span><br><span>--- a/res/res_resolver_unbound.c</span><br><span>+++ b/res/res_resolver_unbound.c</span><br><span>@@ -260,11 +260,11 @@</span><br><span> if (!ast_dns_resolver_set_result(query, ub_result->secure, ub_result->bogus, ub_result->rcode,</span><br><span> S_OR(ub_result->canonname, ast_dns_query_get_name(query)), ub_result->answer_packet, ub_result->answer_len)) {</span><br><span> int i;</span><br><span style="color: hsl(0, 100%, 40%);">- char *data;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *result_data;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- for (i = 0; (data = ub_result->data[i]); i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ for (i = 0; (result_data = ub_result->data[i]); i++) {</span><br><span> if (ast_dns_resolver_add_record(query, ub_result->qtype, ub_result->qclass, ub_result->ttl,</span><br><span style="color: hsl(0, 100%, 40%);">- data, ub_result->len[i])) {</span><br><span style="color: hsl(120, 100%, 40%);">+ result_data, ub_result->len[i])) {</span><br><span> break;</span><br><span> }</span><br><span> }</span><br><span>diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c</span><br><span>index 19c7338..5f06fd1 100644</span><br><span>--- a/res/res_rtp_asterisk.c</span><br><span>+++ b/res/res_rtp_asterisk.c</span><br><span>@@ -3087,11 +3087,11 @@</span><br><span> ao2_ref(ice, -1);</span><br><span> ao2_lock(instance);</span><br><span> if (status != PJ_SUCCESS) {</span><br><span style="color: hsl(0, 100%, 40%);">- char buf[100];</span><br><span style="color: hsl(120, 100%, 40%);">+ char err_buf[100];</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- pj_strerror(status, buf, sizeof(buf));</span><br><span style="color: hsl(120, 100%, 40%);">+ pj_strerror(status, err_buf, sizeof(err_buf));</span><br><span> ast_log(LOG_WARNING, "PJ ICE Rx error status code: %d '%s'.\n",</span><br><span style="color: hsl(0, 100%, 40%);">- (int)status, buf);</span><br><span style="color: hsl(120, 100%, 40%);">+ (int)status, err_buf);</span><br><span> return -1;</span><br><span> }</span><br><span> if (!rtp->passthrough) {</span><br><span>diff --git a/res/stasis/command.c b/res/stasis/command.c</span><br><span>index 83a1a4c..d79272a 100644</span><br><span>--- a/res/stasis/command.c</span><br><span>+++ b/res/stasis/command.c</span><br><span>@@ -37,7 +37,7 @@</span><br><span> void *data;</span><br><span> command_data_destructor_fn data_destructor;</span><br><span> int retval;</span><br><span style="color: hsl(0, 100%, 40%);">- int is_done:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int is_done:1;</span><br><span> };</span><br><span> </span><br><span> static void command_dtor(void *obj)</span><br><span>diff --git a/res/stasis/control.c b/res/stasis/control.c</span><br><span>index d3ea7d7..96ddf39 100644</span><br><span>--- a/res/stasis/control.c</span><br><span>+++ b/res/stasis/control.c</span><br><span>@@ -99,7 +99,7 @@</span><br><span> /*!</span><br><span> * When set, /c app_stasis should exit and continue in the dialplan.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">- int is_done:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int is_done:1;</span><br><span> };</span><br><span> </span><br><span> static void control_dtor(void *obj)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13097">change 13097</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13097"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25 </div>
<div style="display:none"> Gerrit-Change-Number: 13097 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>