From df090a2a6b1042b8c575ecce241c021e16a792be Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Mon, 3 Jan 2011 21:39:36 +0100 Subject: [PATCH] free() -> switch_safe_free() --- .../mod_cdr_pg_csv/mod_cdr_pg_csv.c | 18 +++++++++--------- .../mod_cdr_sqlite/mod_cdr_sqlite.c | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 9f4260ddbb..e515f8db19 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -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; diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index b3334fea97..1b91f1242a 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -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); }