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

Freeswitch SVN anthm at freeswitch.org
Wed Oct 3 19:42:41 EDT 2007


Author: anthm
Date: Wed Oct  3 19:42:40 2007
New Revision: 5789

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

Log:
be extra careful

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	Wed Oct  3 19:42:40 2007
@@ -1360,8 +1360,9 @@
 			}
 			
 			if (tech_pvt->sofia_private) {
-				free(tech_pvt->sofia_private);
+				sofia_private = tech_pvt->sofia_private;
 				tech_pvt->sofia_private = NULL;
+				free(sofia_private);
 			}
 
 			tech_pvt->nh = NULL;		
@@ -1998,7 +1999,6 @@
 														 NULL, NULL, NULL, MODNAME, context, destination_number);
 
 	if (tech_pvt->caller_profile) {
-
 		/* Loop thru unknown Headers Here so we can do something with them */
 		for (un = sip->sip_unknown; un; un = un->un_next) {
 			if (!strncasecmp(un->un_name, "Alert-Info", 10)) {
@@ -2031,11 +2031,12 @@
 		switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 	}
 
-	if (!(tech_pvt->sofia_private = malloc(sizeof(*tech_pvt->sofia_private)))) {
+	if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
 		abort();
 	}
-	memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
-
+	memset(sofia_private, 0, sizeof(*sofia_private));
+	tech_pvt->sofia_private = sofia_private;
+	
 	if ((profile->pflags & PFLAG_PRESENCE)) {
 		sofia_presence_set_chat_hash(tech_pvt, sip);
 	}

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Wed Oct  3 19:42:40 2007
@@ -511,7 +511,7 @@
 
 	if (!tech_pvt->nh) {
 		char *d_url = NULL, *url = NULL;
-
+		sofia_private_t *sofia_private;
 		if (switch_strlen_zero(tech_pvt->dest)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "URL Error! [%s]\n", tech_pvt->dest);
 			return SWITCH_STATUS_FALSE;
@@ -534,11 +534,11 @@
 
 		switch_safe_free(d_url);
 		
-		if (!(tech_pvt->sofia_private = malloc(sizeof(*tech_pvt->sofia_private)))) {
+		if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
 			abort();
 		}
-		memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
-
+		memset(sofia_private, 0, sizeof(*sofia_private));
+		tech_pvt->sofia_private = sofia_private;
 		switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
 		nua_handle_bind(tech_pvt->nh, tech_pvt->sofia_private);
 



More information about the Freeswitch-svn mailing list