[Asterisk-code-review] res_stasis_snoop: Fix snoop crash (asterisk[18])
Friendly Automation
asteriskteam at digium.com
Mon Jan 30 08:31:30 CST 2023
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19862 )
Change subject: res_stasis_snoop: Fix snoop crash
......................................................................
res_stasis_snoop: Fix snoop crash
Added NULL pointer check and channel lock to prevent resource release
while the chanspy is processing.
ASTERISK-29604
Change-Id: Ibdc675f98052da32333b19685b1708a3751b6d24
---
M res/res_stasis_snoop.c
1 file changed, 21 insertions(+), 3 deletions(-)
Approvals:
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/res/res_stasis_snoop.c b/res/res_stasis_snoop.c
index 70cdd7c..12964cc 100644
--- a/res/res_stasis_snoop.c
+++ b/res/res_stasis_snoop.c
@@ -135,9 +135,13 @@
}
ast_multi_channel_blob_add_channel(payload, "spyer_channel", snoop_snapshot);
- spyee_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(snoop->spyee_chan));
- if (spyee_snapshot) {
- ast_multi_channel_blob_add_channel(payload, "spyee_channel", spyee_snapshot);
+ if (snoop->spyee_chan) {
+ ast_channel_lock(snoop->spyee_chan);
+ spyee_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(snoop->spyee_chan));
+ ast_channel_unlock(snoop->spyee_chan);
+ if (spyee_snapshot) {
+ ast_multi_channel_blob_add_channel(payload, "spyee_channel", spyee_snapshot);
+ }
}
message = stasis_message_create(type, payload);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19862
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: Ibdc675f98052da32333b19685b1708a3751b6d24
Gerrit-Change-Number: 19862
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230130/ea22adfb/attachment-0001.html>
More information about the asterisk-code-review
mailing list