From: Maximilian Fridrich Date: Thu, 15 Feb 2024 16:07:27 +0000 (+0100) Subject: res_pjsip_session: Reset pending_media_state->read_callbacks X-Git-Tag: 21.3.0-rc1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8409ed1303f373e0a62c11158f849e98189ee776;p=thirdparty%2Fasterisk.git res_pjsip_session: Reset pending_media_state->read_callbacks In handle_negotiated_sdp the pending_media_state->read_callbacks must be reset before they are added in the SDP handlers in handle_negotiated_sdp_session_media. Otherwise, old callbacks for removed streams and file descriptors could be added to the channel and Asterisk would poll on non-existing file descriptors. Resolves: #611 (cherry picked from commit c5a6d8a6dbd2057878b96b21cc983082710eaa4c) --- diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 496af5deca..db5bdd1202 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -1115,6 +1115,8 @@ static int handle_negotiated_sdp(struct ast_sip_session *session, const pjmedia_ SCOPE_EXIT_RTN_VALUE(-1, "Media stream count mismatch\n"); } + AST_VECTOR_RESET(&session->pending_media_state->read_callbacks, AST_VECTOR_ELEM_CLEANUP_NOOP); + for (i = 0; i < local->media_count; ++i) { struct ast_sip_session_media *session_media; struct ast_stream *stream;