<p> Attention is currently required from: Sean Bright, George Joseph, Joe. </p>
<p>Patch set 11:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4; color: #000000;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16160">View Change</a></p><p>2 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="null">File res/res_pjsip_registrar.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16160/comment/72d87b5a_9fe9ccf6">Patch Set #11, Line 733:</a> <code style="font-family:monospace,monospace">                     remove_excess_contacts(unavail_contacts, contacts, contact_count - aor->max_contacts, aor->remove_existing);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">If for some reason 'unavail_contacts' is NULL here (which it could because 'ast_sip_location_retrieve_aor_contacts_filtered' could return such) then this will crash within the function call.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16160/comment/af383db4_f192e797">Patch Set #11, Line 736:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">                       contacts = ast_sip_location_retrieve_aor_contacts_nolock(aor);<br>                        if (!contacts) {<br>                              response->code = 500;<br>                              pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), details.pool);<br>                         return;<br>                       }<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Were you able to determine why the contacts are not being removed from the 'contacts' container in the 'remove_excess_contacts' call? Or why the 'contacts' object is not properly updating? It doesn't seem like there is a reason why you'd have to re-retrieve contacts.</p><p style="white-space: pre-wrap; word-wrap: break-word;">As is, I don't think this is the right thing to do here as I am not sure what side effects could occur by doing such. </p><p style="white-space: pre-wrap; word-wrap: break-word;">First, 'ast_sip_location_retrieve_aor_contacts_nolock' returns a reference counted object. I'm not seeing where it gets unref'd, so that means upon function return there will be a ref leak on contacts.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Second, in this function, 'contacts' is a pointer (or copy of one) local to this function to a reference counted object. With this code here, the calling function has a list of contacts, and now this function has a separate list which may differ in memory. Thus there is the potential for them to be out of sync which may cause problems elsewhere/later (i.e. upon return the original container may be 'stale')</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16160">change 16160</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/c/asterisk/+/16160"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Ia2711b08f2b4d1177411b1be23e970d7fdff5784 </div>
<div style="display:none"> Gerrit-Change-Number: 16160 </div>
<div style="display:none"> Gerrit-PatchSet: 11 </div>
<div style="display:none"> Gerrit-Owner: Joe <ynadiv@corpit.xyz> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-CC: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Attention: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-Attention: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Attention: Joe <ynadiv@corpit.xyz> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 21 Sep 2021 22:21:31 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>