From 33fd755e819dc85a96718abc0ae26a9b46f14800 Mon Sep 17 00:00:00 2001 From: nanang Date: Thu, 28 Jul 2016 08:21:45 +0000 Subject: [PATCH 2/3] Fix #1946: Avoid deinitialization of uninitialized client auth session. --- pjsip/src/pjsip/sip_dialog.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c index f03885d..421ddc4 100644 --- a/pjsip/src/pjsip/sip_dialog.c +++ b/pjsip/src/pjsip/sip_dialog.c @@ -92,6 +92,12 @@ static pj_status_t create_dialog( pjsip_user_agent *ua, pj_list_init(&dlg->inv_hdr); pj_list_init(&dlg->rem_cap_hdr); + /* Init client authentication session. */ + status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt, + dlg->pool, 0); + if (status != PJ_SUCCESS) + goto on_error; + status = pj_mutex_create_recursive(pool, dlg->obj_name, &dlg->mutex_); if (status != PJ_SUCCESS) goto on_error; @@ -283,12 +289,6 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua, /* Initial route set is empty. */ pj_list_init(&dlg->route_set); - /* Init client authentication session. */ - status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt, - dlg->pool, 0); - if (status != PJ_SUCCESS) - goto on_error; - /* Register this dialog to user agent. */ status = pjsip_ua_register_dlg( ua, dlg ); if (status != PJ_SUCCESS) @@ -506,12 +506,6 @@ pj_status_t create_uas_dialog( pjsip_user_agent *ua, } dlg->route_set_frozen = PJ_TRUE; - /* Init client authentication session. */ - status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt, - dlg->pool, 0); - if (status != PJ_SUCCESS) - goto on_error; - /* Increment the dialog's lock since tsx may cause the dialog to be * destroyed prematurely (such as in case of transport error). */ -- 2.7.4