[Asterisk-code-review] pjsip: avoid possible crash req caps allocation failure (asterisk[13])
Scott Griepentrog
asteriskteam at digium.com
Tue Sep 8 10:42:41 CDT 2015
Scott Griepentrog has uploaded a new change for review.
https://gerrit.asterisk.org/1215
Change subject: pjsip: avoid possible crash req_caps allocation failure
......................................................................
pjsip: avoid possible crash req_caps allocation failure
Make certain that the pjsip session has not failed to
allocate the format capabilities structure, which can
otherwise cause a crash when referenced.
ASTERISK-25323
Change-Id: I602790ba12714741165e441cc64a3ecde4cb5750
---
M res/res_pjsip_session.c
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/15/1215/1
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 16ed38d..dd8b800 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1297,6 +1297,10 @@
session->contact = ao2_bump(contact);
session->inv_session = inv_session;
session->req_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+ if (!session->req_caps) {
+ /* Release the ref held by session->inv_session */
+ ao2_ref(session, -1);
+ }
if ((endpoint->dtmf == AST_SIP_DTMF_INBAND) || (endpoint->dtmf == AST_SIP_DTMF_AUTO)) {
dsp_features |= DSP_FEATURE_DIGIT_DETECT;
--
To view, visit https://gerrit.asterisk.org/1215
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I602790ba12714741165e441cc64a3ecde4cb5750
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
More information about the asterisk-code-review
mailing list