[Asterisk-cvs] asterisk/res res_config_odbc.c,1.18,1.19

markster at lists.digium.com markster at lists.digium.com
Wed Jan 19 22:50:18 CST 2005


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv13227/res

Modified Files:
	res_config_odbc.c 
Log Message:
Fix ODBC to clear title each time (bug #3379)


Index: res_config_odbc.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_config_odbc.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- res_config_odbc.c	16 Jan 2005 22:58:44 -0000	1.18
+++ res_config_odbc.c	20 Jan 2005 04:53:17 -0000	1.19
@@ -186,19 +186,21 @@
 	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 @@
 	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 @@
 				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)




More information about the svn-commits mailing list