summaryrefslogtreecommitdiff
path: root/third-party/pjproject/patches/0002-Fix-1946-Avoid-deinitialization-of-uninitialized-cli.patch
blob: c4288a389d549c27d86e951a448adc3c269134bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 33fd755e819dc85a96718abc0ae26a9b46f14800 Mon Sep 17 00:00:00 2001
From: nanang <nanang@localhost>
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