]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't deref NULL. Found by Klockwork (www.klocwork.com)
authorMichael Jerris <mike@jerris.com>
Tue, 27 May 2008 19:45:55 +0000 (19:45 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 27 May 2008 19:45:55 +0000 (19:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8699 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c

index 34252647c13f2487fdb29048660417c6e9f548e1..6f8ba4abca9723f15a19bc8482d03b8adbf90cb1 100644 (file)
@@ -212,13 +212,16 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
        }
 
        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 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
        free(path);
 
 
-       if (log_line && log_line != g_template_str) {
+       if (log_line != g_template_str) {
                free(log_line);
        }