Merge "pjsip: avoid possible crash req_caps allocation failure"
This commit is contained in:
commit
8e269a467d
1 changed files with 5 additions and 0 deletions
|
@ -1297,6 +1297,11 @@ struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint,
|
||||||
session->contact = ao2_bump(contact);
|
session->contact = ao2_bump(contact);
|
||||||
session->inv_session = inv_session;
|
session->inv_session = inv_session;
|
||||||
session->req_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
|
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)) {
|
if ((endpoint->dtmf == AST_SIP_DTMF_INBAND) || (endpoint->dtmf == AST_SIP_DTMF_AUTO)) {
|
||||||
dsp_features |= DSP_FEATURE_DIGIT_DETECT;
|
dsp_features |= DSP_FEATURE_DIGIT_DETECT;
|
||||||
|
|
Loading…
Reference in a new issue