<p>sungtae kim has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19781">View Change</a></p><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 while<br>the chanspy is processing.<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;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/81/19781/1</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..28a0e70 100644</span><br><span>--- a/res/res_stasis_snoop.c</span><br><span>+++ b/res/res_stasis_snoop.c</span><br><span>@@ -129,15 +129,21 @@</span><br><span>          return;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_lock(snoop->chan);</span><br><span>    snoop_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(snoop->chan));</span><br><span style="color: hsl(120, 100%, 40%);">+       ast_channel_unlock(snoop->chan);</span><br><span>  if (!snoop_snapshot) {</span><br><span>               return;</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/+/19781">change 19781</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/+/19781"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ibdc675f98052da32333b19685b1708a3751b6d24 </div>
<div style="display:none"> Gerrit-Change-Number: 19781 </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-MessageType: newchange </div>