aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_config_odbc.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-20 04:53:17 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-20 04:53:17 +0000
commitcbdee91e8373d87912ceb88111331ed1c6345517 (patch)
tree1283b173d9f6757a0c18d0c32f19215946885284 /res/res_config_odbc.c
parent591b532e8d5a1f68becfa2c6b03ceb319ea0dce4 (diff)
Fix ODBC to clear title each time (bug #3379)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4851 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_config_odbc.c')
-rwxr-xr-xres/res_config_odbc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index 2a27c06a2..f8813de7f 100755
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -186,19 +186,21 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
struct ast_variable *var=NULL, *prev=NULL;
struct ast_config *cfg=NULL;
struct ast_category *cat=NULL;
+ struct ast_realloca ra;
SQLLEN rowcount=0;
SQLULEN colsize;
SQLSMALLINT colcount=0;
SQLSMALLINT datatype;
SQLSMALLINT decimaldigits;
SQLSMALLINT nullable;
+
va_list aq;
-
va_copy(aq, ap);
if (!table)
return NULL;
+ memset(&ra, 0, sizeof(ra));
obj = fetch_odbc_obj(database);
if (!obj)
@@ -269,6 +271,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
while (rowcount--) {
var = NULL;
prev = NULL;
+ title = NULL;
res = SQLFetch(stmt);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
@@ -297,7 +300,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
chunk = strsep(&stringp, ";");
if (chunk && !ast_strlen_zero(ast_strip(chunk))) {
if (initfield && !strcmp(initfield, coltitle) && !title)
- title = ast_strdupa(chunk);
+ title = ast_restrdupa(&ra, chunk);
if (prev) {
prev->next = ast_new_variable(coltitle, chunk);
if (prev->next)