Merged revisions 51205 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r51205 | russell | 2007-01-17 17:31:11 -0600 (Wed, 17 Jan 2007) | 5 lines 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/trunk@51207 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
e412c90ae7
commit
a27e12bd06
|
@ -431,6 +431,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
|
||||||
|
|
||||||
if (!ast_strlen_zero((*query)->sql_read) && ast_strlen_zero((*query)->readhandle[0])) {
|
if (!ast_strlen_zero((*query)->sql_read) && ast_strlen_zero((*query)->readhandle[0])) {
|
||||||
free(*query);
|
free(*query);
|
||||||
|
*query = NULL;
|
||||||
ast_log(LOG_ERROR, "There is SQL, but no ODBC class to be used for reading: %s\n", catg);
|
ast_log(LOG_ERROR, "There is SQL, but no ODBC class to be used for reading: %s\n", catg);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -443,6 +444,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
|
||||||
|
|
||||||
if (!ast_strlen_zero((*query)->sql_write) && ast_strlen_zero((*query)->writehandle[0])) {
|
if (!ast_strlen_zero((*query)->sql_write) && ast_strlen_zero((*query)->writehandle[0])) {
|
||||||
free(*query);
|
free(*query);
|
||||||
|
*query = NULL;
|
||||||
ast_log(LOG_ERROR, "There is SQL, but no ODBC class to be used for writing: %s\n", catg);
|
ast_log(LOG_ERROR, "There is SQL, but no ODBC class to be used for writing: %s\n", catg);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -457,6 +459,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));
|
(*query)->acf = ast_calloc(1, sizeof(struct ast_custom_function));
|
||||||
if (! (*query)->acf) {
|
if (! (*query)->acf) {
|
||||||
free(*query);
|
free(*query);
|
||||||
|
*query = NULL;
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,6 +472,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
|
||||||
if (!((*query)->acf->name)) {
|
if (!((*query)->acf->name)) {
|
||||||
free((*query)->acf);
|
free((*query)->acf);
|
||||||
free(*query);
|
free(*query);
|
||||||
|
*query = NULL;
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,6 +482,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
|
||||||
free((char *)(*query)->acf->name);
|
free((char *)(*query)->acf->name);
|
||||||
free((*query)->acf);
|
free((*query)->acf);
|
||||||
free(*query);
|
free(*query);
|
||||||
|
*query = NULL;
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,6 +524,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
|
||||||
free((char *)(*query)->acf->name);
|
free((char *)(*query)->acf->name);
|
||||||
free((*query)->acf);
|
free((*query)->acf);
|
||||||
free(*query);
|
free(*query);
|
||||||
|
*query = NULL;
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue