]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
some more protection against printing null.
authorMichael Jerris <mike@jerris.com>
Tue, 6 Feb 2007 18:37:01 +0000 (18:37 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 6 Feb 2007 18:37:01 +0000 (18:37 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4137 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c

index eae5e77b0676a4e3565de4909c52f7c50cb9b53d..ac094a658cdadf2c9c4a9da46baf382d8b1a90f2 100644 (file)
@@ -2048,7 +2048,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
             }
                        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 @@ static void logger(void *logarg, char const *fmt, va_list ap)
                }
 #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 @@ static void sip_i_message(int status,
                                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 @@ static char *get_auth_data(char *dbname, char *nonce, char *npassword, size_t le
                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;