if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Describe Column error!\n[%s]\n\n", sql);
ast_category_destroy(cat);
- continue;
+ goto next_sql_fetch;
}
indicator = 0;
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
ast_category_destroy(cat);
- continue;
+ goto next_sql_fetch;
}
stringp = rowdata;
while (stringp) {
}
}
ast_category_append(cfg, cat);
+next_sql_fetch:;
}
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
PQfinish(pgsqlConn);
pgsqlConn = NULL;
}
+ ast_config_destroy(cfg);
return NULL;
}
if (pgresult) {
ast_log(LOG_ERROR, "PostgreSQL RealTime: detected invalid input: '%s'\n", newval);
va_end(ap);
+ ast_config_destroy(cfg);
return NULL;
}
if (pgresult) {
ast_log(LOG_ERROR, "PostgreSQL RealTime: detected invalid input: '%s'\n", newval);
va_end(ap);
+ ast_config_destroy(cfg);
return NULL;
}
/* We now have our complete statement; Lets connect to the server and execute it. */
ast_mutex_lock(&pgsql_lock);
- if (pgsql_exec(database, table, ast_str_buffer(sql), &result) != 0) {
+ if (pgsql_exec(database, table, ast_str_buffer(sql), &result) != 0) {
ast_mutex_unlock(&pgsql_lock);
+ ast_config_destroy(cfg);
return NULL;
} else {
ExecStatusType result_status = PQresultStatus(result);
PQresultErrorMessage(result), PQresStatus(result_status));
PQclear(result);
ast_mutex_unlock(&pgsql_lock);
+ ast_config_destroy(cfg);
return NULL;
}
}
if (!(fieldnames = ast_calloc(1, numFields * sizeof(char *)))) {
PQclear(result);
ast_mutex_unlock(&pgsql_lock);
+ ast_config_destroy(cfg);
return NULL;
}
for (i = 0; i < numFields; i++)