mirror of https://github.com/asterisk/asterisk
On an outbound websocket connection, when the triggering caller hangs up, webchan_hangup() closes the outbound websocket session and sets the websocket session handle to NULL. If the hangup happened in the tiny window between opening the outbound websocket connection and before read_thread_handler() was able to send the MEDIA_START message, it could segfault because the websocket session handle was NULL. If it didn't actually segfault, there was also the possibility that the websocket instance wouldn't get cleaned up which could also cause the channel snapshot to not get cleaned up. That could cause memory leaks and `core show channels` to list phantom WebSocket channels. To prevent the race, the send_event() macro now locks the websocket_pvt instance and checks the websocket session handle before attempting to send the MEDIA_START message. Resolves: #1643 Resolves: #1645pull/1656/head
parent
20e40a9a48
commit
1f77cdc7c3
Loading…
Reference in new issue