[asterisk-addons-commits] seanbright: branch 1.6.2 r1151 - /branches/1.6.2/res/res_config_mysql.c

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Thu May 5 15:23:59 CDT 2011


Author: seanbright
Date: Thu May  5 15:23:52 2011
New Revision: 1151

URL: http://svnview.digium.com/svn/asterisk-addons?view=rev&rev=1151
Log:
Don't duplicate our data on the stack and just use the MYSQL_ROW directly.

With large result sets we were blowing out the stack.

(closes issue #19090)
Reported by: mickecarlsson
Patches:
      issue19090_trunk_svn.patch uploaded by seanbright (license 71)
Tested by: mickecarlsson

Modified:
    branches/1.6.2/res/res_config_mysql.c

Modified: branches/1.6.2/res/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/res/res_config_mysql.c?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- branches/1.6.2/res/res_config_mysql.c (original)
+++ branches/1.6.2/res/res_config_mysql.c Thu May  5 15:23:52 2011
@@ -390,7 +390,7 @@
 				} else if (ast_strlen_zero(row[i])) {
 					row[i] = " ";
 				}
-				for (stringp = ast_strdupa(row[i]), chunk = strsep(&stringp, ";"); chunk; chunk = strsep(&stringp, ";")) {
+				for (stringp = row[i], chunk = strsep(&stringp, ";"); chunk; chunk = strsep(&stringp, ";")) {
 					if (prev) {
 						if ((prev->next = ast_variable_new(fields[i].name, chunk, ""))) {
 							prev = prev->next;
@@ -516,7 +516,7 @@
 			for (i = 0; i < numFields; i++) {
 				if (ast_strlen_zero(row[i]))
 					continue;
-				for (stringp = ast_strdupa(row[i]), chunk = strsep(&stringp, ";"); chunk; chunk = strsep(&stringp, ";")) {
+				for (stringp = row[i], chunk = strsep(&stringp, ";"); chunk; chunk = strsep(&stringp, ";")) {
 					if (chunk && !ast_strlen_zero(ast_strip(chunk))) {
 						if (initfield && !strcmp(initfield, fields[i].name)) {
 							ast_category_rename(cat, chunk);




More information about the asterisk-addons-commits mailing list