<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7806">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbx: Prevent execution of NULL pointer.<br><br>pbx_extension_helper has a check for q->swo.exec == NULL but it doesn't<br>actually return so we would still run the function.  Fix the return.<br>Move the 'int res' variable into the only scope which uses it.<br><br>Also fix a copy-paste error in ast_pbx_init which could result in a<br>crash on allocation failure (we exit with a normal error instead).<br><br>Change-Id: I0693af921fdc7f56b6a72a21fb816ed08b960a69<br>---<br>M main/pbx.c<br>1 file changed, 7 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/06/7806/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/pbx.c b/main/pbx.c<br>index 12daa67..b850e8e 100644<br>--- a/main/pbx.c<br>+++ b/main/pbx.c<br>@@ -2863,7 +2863,6 @@<br>       struct ast_exten *e;<br>  struct ast_app *app;<br>  char *substitute = NULL;<br>-     int res;<br>      struct pbx_find_info q = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */<br>     char passdata[EXT_DATA_SIZE];<br>         int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);<br>@@ -2880,9 +2879,12 @@<br>                   ast_unlock_contexts();<br>                        return -1;      /* success, we found it */<br>            } else if (action == E_FINDLABEL) { /* map the label to a priority */<br>-                        res = e->priority;<br>+                        int res = e->priority;<br>+<br>                  ast_unlock_contexts();<br>-                       return res;     /* the priority we were looking for */<br>+<br>+                    /* the priority we were looking for */<br>+                       return res;<br>           } else {        /* spawn */<br>                   if (!e->cached_app)<br>                                e->cached_app = pbx_findapp(e->app);<br>@@ -2932,7 +2934,7 @@<br>             } else {<br>                      if (!q.swo->exec) {<br>                                ast_log(LOG_WARNING, "No execution engine for switch %s\n", q.swo->name);<br>-                               res = -1;<br>+                            return -1;<br>                    }<br>                     return q.swo->exec(c, q.foundcontext ? q.foundcontext : context, exten, priority, callerid, q.data);<br>               }<br>@@ -8922,7 +8924,7 @@<br>      /* This is protected by the context_and_merge lock */<br>         autohints = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, HASH_EXTENHINT_SIZE,<br>               autohint_hash_cb, autohint_cmp);<br>-     if (hintdevices) {<br>+   if (autohints) {<br>              ao2_container_register("autohints", autohints, print_autohint_key);<br>         }<br>     statecbs = ao2_container_alloc(1, NULL, statecbs_cmp);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7806">change 7806</a>. To unsubscribe, 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/7806"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I0693af921fdc7f56b6a72a21fb816ed08b960a69 </div>
<div style="display:none"> Gerrit-Change-Number: 7806 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>