[Asterisk-code-review] res/res_pjsip_session.c: Check that media type matches in function as... (asterisk[16])

George Joseph asteriskteam at digium.com
Wed Jan 6 08:59:52 CST 2021


Attention is currently required from: Robert Cripps.
George Joseph has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/15230 )

Change subject: res/res_pjsip_session.c: Check that media type matches in function ast_sip_session_media_state_add.
......................................................................


Patch Set 1: Code-Review-1

(3 comments)

File res/res_pjsip_session.c:

https://gerrit.asterisk.org/c/asterisk/+/15230/comment/9c604c23_d7ccebf7 
PS1, Line 500: 		if (session_media && session_media->type == type) {
So, if we got a session_media object but its type doesn't match, what happens to it?  I _think_ it'll leak if we then use the one from the active state.  If we don't use the one from the active state, we'll wind up using this one anyway.  See below.


https://gerrit.asterisk.org/c/asterisk/+/15230/comment/5879f3fa_02090fce 
PS1, Line 507: 		session_media = AST_VECTOR_GET(&session->active_media_state->sessions, position);
If we get here, we've lost the pointer to the original one and can't free it before replacing it.


https://gerrit.asterisk.org/c/asterisk/+/15230/comment/c087e861_e6f1d872 
PS1, Line 533: 	if (!session_media) {
If there was an existing session_media but the type didn't match and we didn't use the active one, we won't create a new one so when we do the replace further down, we'll just be replacing the original one with itself.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15230
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I6f6efa9b821ebe8881bb4c8c957f8802ddcb4b5d
Gerrit-Change-Number: 15230
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Cripps <rcripps at voxbone.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: Robert Cripps <rcripps at voxbone.com>
Gerrit-Comment-Date: Wed, 06 Jan 2021 14:59:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210106/b5ef22a9/attachment.html>


More information about the asterisk-code-review mailing list