aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-17 23:31:11 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-17 23:31:11 +0000
commitda72f3ec37a13e5316c81b599f029c1a99f610fb (patch)
treebf54f3e5f8ea99a73a274a576e959d8c4ddb8eb8 /funcs
parentc5bf08ff69e47eff0dc8dd2067a983b4c17ebb21 (diff)
Fix some instances where when loading func_odbc, a double-free could occur.
Also, remove an unneeded error message. If the failure condition is actually a memory allocation failure, a log message will already be generated automatically. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@51205 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_odbc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c
index 529a342ff..a03ccb184 100644
--- a/funcs/func_odbc.c
+++ b/funcs/func_odbc.c
@@ -363,6 +363,8 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
if ((tmp = ast_variable_retrieve(cfg, catg, "dsn"))) {
ast_copy_string((*query)->dsn, tmp, sizeof((*query)->dsn));
} else {
+ free(*query);
+ *query = NULL;
return -1;
}
@@ -384,6 +386,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);
+ *query = NULL;
return -1;
}
@@ -396,6 +399,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
if (!((*query)->acf->name)) {
free((*query)->acf);
free(*query);
+ *query = NULL;
return -1;
}
@@ -405,6 +409,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
free((char *)(*query)->acf->name);
free((*query)->acf);
free(*query);
+ *query = NULL;
return -1;
}
@@ -440,6 +445,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
free((char *)(*query)->acf->name);
free((*query)->acf);
free(*query);
+ *query = NULL;
return -1;
}
@@ -496,7 +502,6 @@ static int odbc_load_module(void)
struct acf_odbc_query *query = NULL;
if (init_acf_query(cfg, catg, &query)) {
- ast_log(LOG_ERROR, "Out of memory\n");
free_acf_query(query);
} else {
AST_LIST_INSERT_HEAD(&queries, query, list);