From 9d05ff8ed5f2c898370896ff7a8bb67885596ba1 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Wed, 6 Jun 2007 21:20:11 +0000 Subject: Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- cdr/cdr_adaptive_odbc.c | 2 +- cdr/cdr_odbc.c | 8 ++++---- cdr/cdr_pgsql.c | 12 ++++++------ cdr/cdr_sqlite.c | 6 +++--- cdr/cdr_tds.c | 36 ++++++++++++++++++------------------ 5 files changed, 32 insertions(+), 32 deletions(-) (limited to 'cdr') diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c index c7a282617..9814079a4 100644 --- a/cdr/cdr_adaptive_odbc.c +++ b/cdr/cdr_adaptive_odbc.c @@ -211,7 +211,7 @@ static int load_config(void) if (AST_LIST_FIRST(&(tableptr->columns))) AST_RWLIST_INSERT_TAIL(&odbc_tables, tableptr, list); else - free(tableptr); + ast_free(tableptr); } return res; } diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c index 6738aa6d9..1a8b52143 100644 --- a/cdr/cdr_odbc.c +++ b/cdr/cdr_odbc.c @@ -218,22 +218,22 @@ static int odbc_unload_module(void) if (dsn) { if (option_verbose > 10) ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free dsn\n"); - free(dsn); + ast_free(dsn); } if (username) { if (option_verbose > 10) ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free username\n"); - free(username); + ast_free(username); } if (password) { if (option_verbose > 10) ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free password\n"); - free(password); + ast_free(password); } if (table) { if (option_verbose > 10) ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free table\n"); - free(table); + ast_free(table); } ast_cdr_unregister(name); diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index 34feca621..39639bd70 100644 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -184,17 +184,17 @@ static int my_unload_module(void) if (conn) PQfinish(conn); if (pghostname) - free(pghostname); + ast_free(pghostname); if (pgdbname) - free(pgdbname); + ast_free(pgdbname); if (pgdbuser) - free(pgdbuser); + ast_free(pgdbuser); if (pgpassword) - free(pgpassword); + ast_free(pgpassword); if (pgdbport) - free(pgdbport); + ast_free(pgdbport); if (table) - free(table); + ast_free(table); ast_cdr_unregister(name); return 0; } diff --git a/cdr/cdr_sqlite.c b/cdr/cdr_sqlite.c index bd232b450..b47dd350c 100644 --- a/cdr/cdr_sqlite.c +++ b/cdr/cdr_sqlite.c @@ -161,7 +161,7 @@ static int sqlite_log(struct ast_cdr *cdr) if (zErr) { ast_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr); - free(zErr); + ast_free(zErr); } ast_mutex_unlock(&sqlite_lock); @@ -190,7 +190,7 @@ static int load_module(void) db = sqlite_open(fn, AST_FILE_MODE, &zErr); if (!db) { ast_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr); - free(zErr); + ast_free(zErr); return -1; } @@ -200,7 +200,7 @@ static int load_module(void) res = sqlite_exec(db, sql_create_table, NULL, NULL, &zErr); if (res) { ast_log(LOG_ERROR, "cdr_sqlite: Unable to create table 'cdr': %s\n", zErr); - free(zErr); + ast_free(zErr); goto err; } diff --git a/cdr/cdr_tds.c b/cdr/cdr_tds.c index b4d51729a..736199a4a 100644 --- a/cdr/cdr_tds.c +++ b/cdr/cdr_tds.c @@ -221,16 +221,16 @@ static int tds_log(struct ast_cdr *cdr) } } while (!connected && !retried); - free(accountcode); - free(src); - free(dst); - free(dcontext); - free(clid); - free(channel); - free(dstchannel); - free(lastapp); - free(lastdata); - free(uniqueid); + ast_free(accountcode); + ast_free(src); + ast_free(dst); + ast_free(dcontext); + ast_free(clid); + ast_free(channel); + ast_free(dstchannel); + ast_free(lastapp); + ast_free(lastdata); + ast_free(uniqueid); ast_mutex_unlock(&tds_lock); @@ -246,7 +246,7 @@ static char *anti_injection(const char *str, int len) char *known_bad[] = {"select", "insert", "update", "delete", "drop", ";", "--", "\0"}; int idx; - if ((buf = malloc(len + 1)) == NULL) + if ((buf = ast_malloc(len + 1)) == NULL) { ast_log(LOG_ERROR, "cdr_tds: Out of memory error\n"); return NULL; @@ -413,13 +413,13 @@ static int tds_unload_module(void) ast_cdr_unregister(name); - if (hostname) free(hostname); - if (dbname) free(dbname); - if (dbuser) free(dbuser); - if (password) free(password); - if (charset) free(charset); - if (language) free(language); - if (table) free(table); + if (hostname) ast_free(hostname); + if (dbname) ast_free(dbname); + if (dbuser) ast_free(dbuser); + if (password) ast_free(password); + if (charset) ast_free(charset); + if (language) ast_free(language); + if (table) ast_free(table); return 0; } -- cgit v1.2.3