<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8199">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Corey Farrell: 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;">cdr.c: Fix runtime leak of CDR records.<br><br>Need to remove all CDR's listed by a CDR object from the active_cdrs_all<br>container including the root/master record.<br><br>ASTERISK-27656<br><br>Change-Id: I48b4970663fea98baa262593d2204ef304aaf80e<br>---<br>M main/cdr.c<br>1 file changed, 10 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/cdr.c b/main/cdr.c<br>index 0f6a665..6787c79 100644<br>--- a/main/cdr.c<br>+++ b/main/cdr.c<br>@@ -371,7 +371,7 @@<br> /*! \brief A container of the active master CDRs indexed by Party A channel uniqueid */<br> static struct ao2_container *active_cdrs_master;<br> <br>-/*! \brief A container of all active CDRs indexed by Party B channel name */<br>+/*! \brief A container of all active CDRs with a Party B indexed by Party B channel name */<br> static struct ao2_container *active_cdrs_all;<br> <br> /*! \brief Message router for stasis messages regarding channel state */<br>@@ -971,13 +971,21 @@<br> <br> ast_assert(cdr->is_root);<br> <br>+ /* Hold a ref to the root CDR to ensure the list members don't go away on us. */<br>+ ao2_ref(cdr, +1);<br> ao2_lock(active_cdrs_all);<br>- for (cur = cdr->next; cur; cur = next) {<br>+ for (cur = cdr; cur; cur = next) {<br> next = cur->next;<br> ao2_unlink_flags(active_cdrs_all, cur, OBJ_NOLOCK);<br>+ /*<br>+ * It is safe to still use cur after unlinking because the<br>+ * root CDR holds a ref to all the CDRs in the list and we<br>+ * have a ref to the root CDR.<br>+ */<br> ast_string_field_set(cur, party_b_name, "");<br> }<br> ao2_unlock(active_cdrs_all);<br>+ ao2_ref(cdr, -1);<br> }<br> <br> /*!<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8199">change 8199</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/8199"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15.2 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I48b4970663fea98baa262593d2204ef304aaf80e </div>
<div style="display:none"> Gerrit-Change-Number: 8199 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: 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>