<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6660">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, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Fix leak of persistent endpoint references.<br><br>Do not manually call sip_endpoint_apply_handler from load_all_endpoints.<br>This is not necessary and causes memory leaks.<br><br>Additionally reinitialize persistent->aors when we reuse a persistent<br>object with a new endpoint.<br><br>ASTERISK-27306<br><br>Change-Id: I59bbfc8da8a14d5f4af8c5bb1e71f8592ae823eb<br>---<br>M res/res_pjsip/pjsip_configuration.c<br>1 file changed, 9 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c<br>index 88ffadb..8106676 100644<br>--- a/res/res_pjsip/pjsip_configuration.c<br>+++ b/res/res_pjsip/pjsip_configuration.c<br>@@ -1317,6 +1317,14 @@<br> ast_endpoint_set_state(persistent->endpoint, AST_ENDPOINT_OFFLINE);<br> <br> ao2_link_flags(persistent_endpoints, persistent, OBJ_NOLOCK);<br>+ } else if (strcmp(persistent->aors, endpoint->aors)) {<br>+ char *new_aors = ast_strdup(endpoint->aors);<br>+<br>+ /* make sure we don't NULL persistent->aors if allocation fails. */<br>+ if (new_aors) {<br>+ ast_free(persistent->aors);<br>+ persistent->aors = new_aors;<br>+ }<br> }<br> <br> ao2_ref(persistent->endpoint, +1);<br>@@ -1793,20 +1801,12 @@<br> struct ast_sip_cli_formatter_entry *channel_formatter;<br> struct ast_sip_cli_formatter_entry *endpoint_formatter;<br> <br>-static int on_load_endpoint(void *obj, void *arg, int flags)<br>-{<br>- return sip_endpoint_apply_handler(sip_sorcery, obj);<br>-}<br>-<br> static void load_all_endpoints(void)<br> {<br> struct ao2_container *endpoints;<br> <br> endpoints = ast_sorcery_retrieve_by_fields(sip_sorcery, "endpoint", AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);<br>- if (endpoints) {<br>- ao2_callback(endpoints, OBJ_NODATA, on_load_endpoint, NULL);<br>- ao2_ref(endpoints, -1);<br>- }<br>+ ao2_cleanup(endpoints);<br> }<br> <br> int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_module_info)<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6660">change 6660</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/6660"/><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: I59bbfc8da8a14d5f4af8c5bb1e71f8592ae823eb </div>
<div style="display:none"> Gerrit-Change-Number: 6660 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </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>