diff options
author | Joshua Colp <jcolp@digium.com> | 2015-09-09 17:22:22 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-09-09 17:22:22 -0500 |
commit | 8e269a467db8223f6c14fe97770be7709abad636 (patch) | |
tree | 06f056df212e544a133c499b23198ecb8c71b8d9 /res | |
parent | 647cdcd6a8f5e5dd9b9361929a3c9e4c9d5a8fa3 (diff) | |
parent | fcea6910f60760527d874465f65cb617bc6f88a2 (diff) |
Merge "pjsip: avoid possible crash req_caps allocation failure"
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_session.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 1dcac7e97..fc8724820 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -1297,6 +1297,11 @@ struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint, 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); + return NULL; + } if ((endpoint->dtmf == AST_SIP_DTMF_INBAND) || (endpoint->dtmf == AST_SIP_DTMF_AUTO)) { dsp_features |= DSP_FEATURE_DIGIT_DETECT; |