<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9888">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_resolver_unbound: Fix leak of config nameserver strings.<br><br>Change-Id: I3f396316bb40d1ae6e91f5f688042420f1a540ed<br>---<br>M res/res_resolver_unbound.c<br>1 file changed, 6 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_resolver_unbound.c b/res/res_resolver_unbound.c</span><br><span>index 25f6150..89a934c 100644</span><br><span>--- a/res/res_resolver_unbound.c</span><br><span>+++ b/res/res_resolver_unbound.c</span><br><span>@@ -432,20 +432,22 @@</span><br><span> </span><br><span> if (cfg->global->nameservers) {</span><br><span> struct ao2_iterator it_nameservers;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *nameserver;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *nameserver;</span><br><span> </span><br><span> it_nameservers = ao2_iterator_init(cfg->global->nameservers, 0);</span><br><span style="color: hsl(0, 100%, 40%);">- while ((nameserver = ao2_iterator_next(&it_nameservers))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ while (!res && (nameserver = ao2_iterator_next(&it_nameservers))) {</span><br><span> res = ub_ctx_set_fwd(cfg->global->state->resolver->context, (UNBOUND_CHAR *)nameserver);</span><br><span> </span><br><span> if (res) {</span><br><span> ast_log(LOG_ERROR, "Failed to add nameserver '%s' to unbound resolver: %s\n",</span><br><span> nameserver, ub_strerror(res));</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_iterator_destroy(&it_nameservers);</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(nameserver, -1);</span><br><span> }</span><br><span> ao2_iterator_destroy(&it_nameservers);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> </span><br><span> if (!strcmp(cfg->global->resolv, "system")) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9888">change 9888</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/9888"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I3f396316bb40d1ae6e91f5f688042420f1a540ed </div>
<div style="display:none"> Gerrit-Change-Number: 9888 </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: Kevin Harwell <kharwell@digium.com> </div>