]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
free() -> switch_safe_free()
authorDaniel Swarbrick <daniel@seventhsignal.de>
Mon, 3 Jan 2011 20:39:36 +0000 (21:39 +0100)
committerDaniel Swarbrick <daniel@seventhsignal.de>
Mon, 3 Jan 2011 20:39:36 +0000 (21:39 +0100)
src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c
src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c

index 9f4260ddbbc3a617c08ab744ee73cba7edb54e5c..e515f8db19136d74b96edbc7cf60416de319fecd 100644 (file)
@@ -121,7 +121,7 @@ static void do_rotate(cdr_fd_t *fd)
                p = switch_mprintf("%s.%s", fd->path, date);
                assert(p);
                switch_file_rename(fd->path, p, globals.pool);
-               free(p);
+               switch_safe_free(p);
        }
 
        do_reopen(fd);
@@ -317,12 +317,12 @@ static switch_status_t save_cdr(const char * const template, const char * const
        *tp = 0;
        tp = values;
        values = nullValues;
-       free(tp);
+       switch_safe_free(tp);
 
        sql = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);", globals.db_table, columns, values);
        assert(sql);
-       free(columns);
-       free(values);
+       switch_safe_free(columns);
+       switch_safe_free(values);
 
        if (globals.debug) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Query: \"%s\"\n", sql);
@@ -349,7 +349,7 @@ static switch_status_t save_cdr(const char * const template, const char * const
        }
 
        PQclear(res);
-       free(sql);
+       switch_safe_free(sql);
 
        switch_mutex_unlock(globals.db_mutex);
 
@@ -373,8 +373,8 @@ static switch_status_t save_cdr(const char * const template, const char * const
                write_cdr(path, cdr);
        }
 
-       free(path);
-       free(sql);
+       switch_safe_free(path);
+       switch_safe_free(sql);
 
        return SWITCH_STATUS_FALSE;
 }
@@ -416,7 +416,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                        switch_assert(buf);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
                        switch_event_destroy(&event);
-                       free(buf);
+                       switch_safe_free(buf);
                }
        }
 
@@ -436,7 +436,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
        save_cdr(template_str, expanded_vars);
 
        if (expanded_vars != template_str) {
-               free(expanded_vars);
+               switch_safe_free(expanded_vars);
        }
 
        return status;
index b3334fea9762356701eadae1f2c340fe8c4774a3..1b91f1242ac553baf6dba404ae2f36505737720d 100644 (file)
@@ -140,7 +140,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                        switch_assert(buf);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
                        switch_event_destroy(&event);
-                       free(buf);
+                       switch_safe_free(buf);
                }
        }
 
@@ -160,7 +160,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
        sql = switch_mprintf("INSERT INTO %s VALUES (%s)", globals.db_table, expanded_vars);
        assert(sql);
        write_cdr(sql);
-       free(sql);
+       switch_safe_free(sql);
 
        return status;
 }
@@ -264,8 +264,8 @@ static switch_status_t load_config(switch_memory_pool_t *pool)
 
                /* Check if table exists (try SELECT FROM ...) and create table if query fails */
                switch_cache_db_test_reactive(dbh, select_sql, NULL, create_sql);
-               free(select_sql);
-               free(create_sql);
+               switch_safe_free(select_sql);
+               switch_safe_free(create_sql);
 
                switch_cache_db_release_db_handle(&dbh);
        }