<p>Friendly Automation <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13049">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
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_mwi: potential double unref, and potential unwanted double link<br><br>When creating an unsolicited MWI aggregate subscription it was possible for<br>the subscription object to be double unref'ed. This patch removes the explicit<br>unref as it is not needed since the RAII_VAR will handle it at function end.<br><br>Less concerning there was also a bug that could potentially allow the aggregate<br>subscription object to be added to the unsolicited container twice. This patch<br>ensures it is added only once.<br><br>ASTERISK-28575<br><br>Change-Id: I9ccfdb5ea788bc0c3618db183aae235e53c12763<br>---<br>M res/res_pjsip_mwi.c<br>1 file changed, 11 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c</span><br><span>index 46f890b..d6bed74 100644</span><br><span>--- a/res/res_pjsip_mwi.c</span><br><span>+++ b/res/res_pjsip_mwi.c</span><br><span>@@ -1289,6 +1289,13 @@</span><br><span>                     if (!aggregate_sub) {</span><br><span>                                return 0; /* No MWI aggregation for you */</span><br><span>                   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                   /*</span><br><span style="color: hsl(120, 100%, 40%);">+                     * Just in case we somehow get in the position of recreating with no previous</span><br><span style="color: hsl(120, 100%, 40%);">+                  * aggregate object, set recreate to false here in order to allow the new</span><br><span style="color: hsl(120, 100%, 40%);">+                      * object to be linked into the container below</span><br><span style="color: hsl(120, 100%, 40%);">+                        */</span><br><span style="color: hsl(120, 100%, 40%);">+                   recreate = 0;</span><br><span>                }</span><br><span>    }</span><br><span> </span><br><span>@@ -1330,13 +1337,13 @@</span><br><span> </span><br><span>  if (aggregate_sub) {</span><br><span>                 if (ao2_container_count(aggregate_sub->stasis_subs)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                       ao2_link_flags(unsolicited_mwi, aggregate_sub, OBJ_NOLOCK);</span><br><span style="color: hsl(120, 100%, 40%);">+                   /* Only link if we're dealing with a new aggregate object */</span><br><span style="color: hsl(120, 100%, 40%);">+                      if (!recreate) {</span><br><span style="color: hsl(120, 100%, 40%);">+                              ao2_link_flags(unsolicited_mwi, aggregate_sub, OBJ_NOLOCK);</span><br><span style="color: hsl(120, 100%, 40%);">+                   }</span><br><span>                    if (send_now && sub_added) {</span><br><span>                                 send_notify(aggregate_sub, NULL, 0);</span><br><span>                         }</span><br><span style="color: hsl(0, 100%, 40%);">-               } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                        /* No stasis subscriptions then no MWI data to aggregate */</span><br><span style="color: hsl(0, 100%, 40%);">-                     ao2_ref(aggregate_sub, -1);</span><br><span>          }</span><br><span>    }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13049">change 13049</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/+/13049"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13.29 </div>
<div style="display:none"> Gerrit-Change-Id: I9ccfdb5ea788bc0c3618db183aae235e53c12763 </div>
<div style="display:none"> Gerrit-Change-Number: 13049 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>