<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10379">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_smdi.c: Fix module ref counting and inverted test.<br><br>* We don't need to bump the module reference count for each SMDI listener<br>because the listeners are entirely controlled by the life of the module.<br>When the module is unloaded any active listeners are stopped before the<br>module is unloaded from memory. Also the previous module refs had several<br>off-nominal paths that unbalanced the module ref count.<br><br>* Fixed the smdi_load() return code of 1 concerning the number of<br>listeners. The test was inverted.<br><br>Change-Id: Ic288db51b58e395d6a2fc3847f77176c16988784<br>---<br>M res/res_smdi.c<br>1 file changed, 6 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/79/10379/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_smdi.c b/res/res_smdi.c</span><br><span>index 8622da4..5f96a02 100644</span><br><span>--- a/res/res_smdi.c</span><br><span>+++ b/res/res_smdi.c</span><br><span>@@ -247,8 +247,6 @@</span><br><span> ast_cond_destroy(&iface->mwi_q_cond);</span><br><span> </span><br><span> free(iface);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_module_unref(ast_module_info->self);</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span>@@ -985,6 +983,11 @@</span><br><span> return 0;</span><br><span> </span><br><span> new_ifaces = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, smdi_ifaces_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!new_ifaces) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_config_destroy(conf);</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> for (v = ast_variable_browse(conf, "interfaces"); v; v = v->next) {</span><br><span> RAII_VAR(struct ast_smdi_interface *, iface, NULL, ao2_cleanup);</span><br><span> </span><br><span>@@ -1115,7 +1118,6 @@</span><br><span> }</span><br><span> </span><br><span> ao2_link(new_ifaces, iface);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_module_ref(ast_module_info->self);</span><br><span> } else {</span><br><span> ast_log(LOG_NOTICE, "Ignoring unknown option %s in %s\n", v->name, config_file);</span><br><span> }</span><br><span>@@ -1157,7 +1159,7 @@</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (ao2_container_count(new_ifaces)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ao2_container_count(new_ifaces)) {</span><br><span> res = 1;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10379">change 10379</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/10379"/><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: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic288db51b58e395d6a2fc3847f77176c16988784 </div>
<div style="display:none"> Gerrit-Change-Number: 10379 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>