[Freeswitch-svn] [commit] r8699 - freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv

Freeswitch SVN mikej at freeswitch.org
Tue May 27 15:45:57 EDT 2008


Author: mikej
Date: Tue May 27 15:45:55 2008
New Revision: 8699

Modified:
   freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c

Log:
don't deref NULL. Found by Klockwork (www.klocwork.com)

Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	Tue May 27 15:45:55 2008
@@ -212,13 +212,16 @@
 	}
 
 	if (g_template_str != a_template_str) {
-		if (log_line && log_line != a_template_str) {
+		if (log_line != a_template_str) {
 			switch_safe_free(log_line);
 		}
 		log_line = switch_channel_expand_variables(channel, g_template_str);
 	}
 
-
+	if (!log_line) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating cdr\n");
+		return SWITCH_STATUS_FALSE;
+	}
 
 	path = switch_mprintf("%s%sMaster.csv", log_dir, SWITCH_PATH_SEPARATOR);
 	assert(path);
@@ -226,7 +229,7 @@
 	free(path);
 
 
-	if (log_line && log_line != g_template_str) {
+	if (log_line != g_template_str) {
 		free(log_line);
 	}
 



More information about the Freeswitch-svn mailing list