<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7075">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_config_wizard: Fix leaks and add check for malloc failure.<br><br>wizard_apply_handler():<br>- Free host if we fail to add it to the vector.<br><br>wizard_mapped_observer():<br>- Check for otw allocation failure.<br>- Free otw if we fail to add it to the vector.<br><br>Change-Id: Ib5d3bcabbd9c24dd8a3c9cc692a794a5f60243ad<br>---<br>M res/res_pjsip_config_wizard.c<br>1 file changed, 13 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip_config_wizard.c b/res/res_pjsip_config_wizard.c<br>index c13ff4a..d487c4d 100644<br>--- a/res/res_pjsip_config_wizard.c<br>+++ b/res/res_pjsip_config_wizard.c<br>@@ -1003,7 +1003,10 @@<br>                 char *hosts = ast_strdupa(remote_hosts);<br> <br>           while ((host = ast_strsep(&hosts, ',', AST_STRSEP_TRIM))) {<br>-                      AST_VECTOR_APPEND(&remote_hosts_vector, ast_strdup(host));<br>+                       host = ast_strdup(host);<br>+                     if (host && AST_VECTOR_APPEND(&remote_hosts_vector, host)) {<br>+                             ast_free(host);<br>+                      }<br>             }<br>     }<br> <br>@@ -1170,15 +1173,22 @@<br>         /* We're only interested in memory wizards with the pjsip_wizard tag. */<br>  if (wizard_args && !strcmp(wizard_args, "pjsip_wizard")) {<br>          otw = ast_malloc(sizeof(*otw) + strlen(object_type) + 1);<br>+            if (!otw) {<br>+                  return;<br>+              }<br>+<br>          otw->sorcery = sorcery;<br>            otw->wizard = wizard;<br>              otw->wizard_data = wizard_data;<br>            otw->last_config = NULL;<br>           strcpy(otw->object_type, object_type); /* Safe */<br>          AST_VECTOR_RW_WRLOCK(&object_type_wizards);<br>-              AST_VECTOR_APPEND(&object_type_wizards, otw);<br>+            if (AST_VECTOR_APPEND(&object_type_wizards, otw)) {<br>+                      ast_free(otw);<br>+               } else {<br>+                     ast_debug(1, "Wizard mapped for object_type '%s'\n", object_type);<br>+         }<br>             AST_VECTOR_RW_UNLOCK(&object_type_wizards);<br>-              ast_debug(1, "Wizard mapped for object_type '%s'\n", object_type);<br>  }<br> }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7075">change 7075</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/7075"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ib5d3bcabbd9c24dd8a3c9cc692a794a5f60243ad </div>
<div style="display:none"> Gerrit-Change-Number: 7075 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>