]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_session: Reset pending_media_state->read_callbacks
authorMaximilian Fridrich <m.fridrich@commend.com>
Thu, 15 Feb 2024 16:07:27 +0000 (17:07 +0100)
committerMaximilian Fridrich <m.fridrich@commend.com>
Tue, 19 Mar 2024 20:20:36 +0000 (20:20 +0000)
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

res/res_pjsip_session.c

index 496af5deca05234cf02b6e6a894cc445dfe1e866..db5bdd1202b66adf93692aa78996491942a9475b 100644 (file)
@@ -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;