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

Freeswitch SVN mikej at freeswitch.org
Tue Feb 6 13:37:01 EST 2007


Author: mikej
Date: Tue Feb  6 13:37:01 2007
New Revision: 4137

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

Log:
some more protection against printing null.

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Tue Feb  6 13:37:01 2007
@@ -2048,7 +2048,9 @@
             }
 			set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 			activate_rtp(tech_pvt);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str);
+			if (tech_pvt->local_sdp_str) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str);
+			}
 
 			nua_respond(tech_pvt->nh,
 						SIP_183_SESSION_PROGRESS,
@@ -2172,9 +2174,10 @@
 		}
 #endif
 	}
-	
-	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, (char*) "%s", data);
-	free(data);
+	if (data) {
+		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, (char*) "%s", data);
+		free(data);
+	}
 }
 
 
@@ -2630,7 +2633,7 @@
 				if ((ci = switch_loadable_module_get_chat_interface(proto))) {
 					ci->chat_send(SOFIA_CHAT_PROTO, from_addr, to_addr, "", msg, full_from);
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto ? proto : "(none)");
 				}
 				
 			}
@@ -3024,6 +3027,10 @@
 		switch_mutex_lock(mutex);
 	}
 
+	if (!dbname) {
+		goto end;
+	}
+
 	if (!(db = switch_core_db_open_file(dbname))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", dbname);
 		goto end;



More information about the Freeswitch-svn mailing list