diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-06 21:20:11 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-06 21:20:11 +0000 |
commit | eb5d461ed4688cafadc76bebf329a2fae454dc12 (patch) | |
tree | 5503cb153c9de46c07e3a0a521cc996926ed375b /funcs/func_odbc.c | |
parent | 125558c76fd4870a9133e4974cce6410c89a3593 (diff) |
Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67864 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_odbc.c')
-rw-r--r-- | funcs/func_odbc.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index 3f22cf462..5206c2492 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -603,7 +603,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu ast_copy_string((*query)->sql_read, tmp, sizeof((*query)->sql_read)); if (!ast_strlen_zero((*query)->sql_read) && ast_strlen_zero((*query)->readhandle[0])) { - free(*query); + ast_free(*query); *query = NULL; ast_log(LOG_ERROR, "There is SQL, but no ODBC class to be used for reading: %s\n", catg); return EINVAL; @@ -616,7 +616,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu ast_copy_string((*query)->sql_write, tmp, sizeof((*query)->sql_write)); if (!ast_strlen_zero((*query)->sql_write) && ast_strlen_zero((*query)->writehandle[0])) { - free(*query); + ast_free(*query); *query = NULL; ast_log(LOG_ERROR, "There is SQL, but no ODBC class to be used for writing: %s\n", catg); return EINVAL; @@ -638,7 +638,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu (*query)->acf = ast_calloc(1, sizeof(struct ast_custom_function)); if (! (*query)->acf) { - free(*query); + ast_free(*query); *query = NULL; return ENOMEM; } @@ -650,8 +650,8 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu } if (!((*query)->acf->name)) { - free((*query)->acf); - free(*query); + ast_free((*query)->acf); + ast_free(*query); *query = NULL; return ENOMEM; } @@ -659,9 +659,9 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu asprintf((char **)&((*query)->acf->syntax), "%s(<arg1>[...[,<argN>]])", (*query)->acf->name); if (!((*query)->acf->syntax)) { - free((char *)(*query)->acf->name); - free((*query)->acf); - free(*query); + ast_free((char *)(*query)->acf->name); + ast_free((*query)->acf); + ast_free(*query); *query = NULL; return ENOMEM; } @@ -691,19 +691,19 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu "This function may only be set.\nSQL:\n%s\n", (*query)->sql_write); } else { - free((char *)(*query)->acf->syntax); - free((char *)(*query)->acf->name); - free((*query)->acf); - free(*query); + ast_free((char *)(*query)->acf->syntax); + ast_free((char *)(*query)->acf->name); + ast_free((*query)->acf); + ast_free(*query); ast_log(LOG_WARNING, "Section %s was found, but there was no SQL to execute. Ignoring.\n", catg); return EINVAL; } if (! ((*query)->acf->desc)) { - free((char *)(*query)->acf->syntax); - free((char *)(*query)->acf->name); - free((*query)->acf); - free(*query); + ast_free((char *)(*query)->acf->syntax); + ast_free((char *)(*query)->acf->name); + ast_free((*query)->acf); + ast_free(*query); *query = NULL; return ENOMEM; } @@ -728,14 +728,14 @@ static int free_acf_query(struct acf_odbc_query *query) if (query) { if (query->acf) { if (query->acf->name) - free((char *)query->acf->name); + ast_free((char *)query->acf->name); if (query->acf->syntax) - free((char *)query->acf->syntax); + ast_free((char *)query->acf->syntax); if (query->acf->desc) - free((char *)query->acf->desc); - free(query->acf); + ast_free((char *)query->acf->desc); + ast_free(query->acf); } - free(query); + ast_free(query); } return 0; } |