<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19862">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_stasis_snoop: Fix snoop crash<br><br>Added NULL pointer check and channel lock to prevent resource release<br>while the chanspy is processing.<br><br>ASTERISK-29604<br><br>Change-Id: Ibdc675f98052da32333b19685b1708a3751b6d24<br>---<br>M res/res_stasis_snoop.c<br>1 file changed, 21 insertions(+), 3 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_stasis_snoop.c b/res/res_stasis_snoop.c</span><br><span>index 70cdd7c..12964cc 100644</span><br><span>--- a/res/res_stasis_snoop.c</span><br><span>+++ b/res/res_stasis_snoop.c</span><br><span>@@ -135,9 +135,13 @@</span><br><span>  }</span><br><span>    ast_multi_channel_blob_add_channel(payload, "spyer_channel", snoop_snapshot);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     spyee_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(snoop->spyee_chan));</span><br><span style="color: hsl(0, 100%, 40%);">-   if (spyee_snapshot) {</span><br><span style="color: hsl(0, 100%, 40%);">-           ast_multi_channel_blob_add_channel(payload, "spyee_channel", spyee_snapshot);</span><br><span style="color: hsl(120, 100%, 40%);">+       if (snoop->spyee_chan) {</span><br><span style="color: hsl(120, 100%, 40%);">+           ast_channel_lock(snoop->spyee_chan);</span><br><span style="color: hsl(120, 100%, 40%);">+               spyee_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(snoop->spyee_chan));</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_channel_unlock(snoop->spyee_chan);</span><br><span style="color: hsl(120, 100%, 40%);">+             if (spyee_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_multi_channel_blob_add_channel(payload, "spyee_channel", spyee_snapshot);</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span>    }</span><br><span> </span><br><span>        message = stasis_message_create(type, payload);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19862">change 19862</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/+/19862"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: Ibdc675f98052da32333b19685b1708a3751b6d24 </div>
<div style="display:none"> Gerrit-Change-Number: 19862 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: sungtae kim <pchero21@gmail.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-MessageType: merged </div>