[Freeswitch-svn] [commit] r12701 - freeswitch/trunk/src/mod/endpoints/mod_sofia

FreeSWITCH SVN brian at freeswitch.org
Fri Mar 20 19:34:37 PDT 2009


Author: brian
Date: Fri Mar 20 21:34:37 2009
New Revision: 12701

Log:
free handles in error and failure conditions

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Fri Mar 20 21:34:37 2009
@@ -333,6 +333,14 @@
 	int locked = 0;
 	int check_destroy = 1;
 
+	if (nh && sofia_private == &mod_sofia_globals.keep_private) {
+		if (status >= 300) {
+			nua_handle_bind(nh, NULL);
+			nua_handle_destroy(nh);
+			return;
+		}
+	}
+
 	if (sofia_private && sofia_private != &mod_sofia_globals.destroy_private && sofia_private != &mod_sofia_globals.keep_private) {
 		if ((gateway = sofia_private->gateway)) {
 			if (switch_thread_rwlock_tryrdlock(gateway->profile->rwlock) != SWITCH_STATUS_SUCCESS) {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	Fri Mar 20 21:34:37 2009
@@ -1405,6 +1405,7 @@
 	}
 	
 	nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(h->profile->url), TAG_END());
+	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
 
 	nua_notify(nh,
 			   NUTAG_NEWSUB(1),



More information about the Freeswitch-svn mailing list