Index: pjproject/trunk/pjsip/include/pjsip/sip_auth.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsip/sip_auth.h	(revision 5372)
+++ pjproject/trunk/pjsip/include/pjsip/sip_auth.h	(revision 5373)
@@ -343,4 +343,14 @@
 
 /**
+ * Deinitialize client authentication session data structure.
+ *
+ * @param sess		The client authentication session.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_auth_clt_deinit( pjsip_auth_clt_sess *sess);
+
+
+/**
  * Clone client initialization session. 
  *
Index: pjproject/trunk/pjsip/src/pjsip-simple/publishc.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/publishc.c	(revision 5372)
+++ pjproject/trunk/pjsip/src/pjsip-simple/publishc.c	(revision 5373)
@@ -223,4 +223,6 @@
 	if (pubc->mutex)
 	    pj_mutex_destroy(pubc->mutex);
+
+	pjsip_auth_clt_deinit(&pubc->auth_sess);
 	pjsip_endpt_release_pool(pubc->endpt, pubc->pool);
     }
Index: pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c	(revision 5372)
+++ pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c	(revision 5373)
@@ -177,5 +177,4 @@
 	pj_lock_release(regc->lock);
     } else {
-	pjsip_cached_auth *auth = NULL;
 	pjsip_tpselector_dec_ref(&regc->tp_sel);
 	if (regc->last_transport) {
@@ -192,10 +191,5 @@
 	regc->lock = NULL;
 
-	auth = regc->auth_sess.cached_auth.next;
-	while (auth != &regc->auth_sess.cached_auth) {
-	    pjsip_endpt_release_pool(regc->endpt, auth->pool);
-	    auth = auth->next;
-	}
-
+	pjsip_auth_clt_deinit(&regc->auth_sess);
 	pjsip_endpt_release_pool(regc->endpt, regc->pool);
     }
Index: pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c	(revision 5372)
+++ pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c	(revision 5373)
@@ -500,4 +500,21 @@
 
 
+/* Deinit client session. */
+PJ_DEF(pj_status_t) pjsip_auth_clt_deinit(pjsip_auth_clt_sess *sess)
+{
+    pjsip_cached_auth *auth;
+    
+    PJ_ASSERT_RETURN(sess && sess->endpt, PJ_EINVAL);
+    
+    auth = sess->cached_auth.next;
+    while (auth != &sess->cached_auth) {
+	pjsip_endpt_release_pool(sess->endpt, auth->pool);
+	auth = auth->next;
+    }
+
+    return PJ_SUCCESS;
+}
+
+
 /* Clone session. */
 PJ_DEF(pj_status_t) pjsip_auth_clt_clone( pj_pool_t *pool,
@@ -965,5 +982,5 @@
 				       pjsip_cached_auth *auth )
 {
-    pj_pool_t *auth_pool = pjsip_endpt_create_pool(endpt, "regc_auth%p", 1024, 
+    pj_pool_t *auth_pool = pjsip_endpt_create_pool(endpt, "auth_cli%p", 1024, 
 						   1024);
 
@@ -1164,5 +1181,5 @@
 	    cached_auth = PJ_POOL_ZALLOC_T(sess->pool, pjsip_cached_auth);
 	    cached_auth->pool = pjsip_endpt_create_pool(sess->endpt,
-							"regc_auth%p",
+							"auth_cli%p",
 							1024,
 							1024);
Index: pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_dialog.c	(revision 5372)
+++ pjproject/trunk/pjsip/src/pjsip/sip_dialog.c	(revision 5373)
@@ -120,4 +120,5 @@
 	pj_bzero(&dlg->tp_sel, sizeof(pjsip_tpselector));
     }
+    pjsip_auth_clt_deinit(&dlg->auth_sess);
     pjsip_endpt_release_pool(dlg->endpt, dlg->pool);
 }
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_im.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_im.c	(revision 5372)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_im.c	(revision 5373)
@@ -388,6 +388,8 @@
 		if (status == PJ_SUCCESS) {
 		    /* Done */
+		    pjsip_auth_clt_deinit(&auth);
 		    return;
 		}
+		pjsip_auth_clt_deinit(&auth);
 	    }
 	}
@@ -490,6 +492,8 @@
 		if (status == PJ_SUCCESS) {
 		    /* Done */
+		    pjsip_auth_clt_deinit(&auth);
 		    return;
 		}
+		pjsip_auth_clt_deinit(&auth);
 	    }
 	}
