[asterisk-commits] seanbright: branch 1.8 r317370 - /branches/1.8/addons/res_config_mysql.c

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


Author: seanbright
Date: Thu May  5 15:25:52 2011
New Revision: 317370

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=317370
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.8/addons/res_config_mysql.c

Modified: branches/1.8/addons/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/addons/res_config_mysql.c?view=diff&rev=317370&r1=317369&r2=317370
==============================================================================
--- branches/1.8/addons/res_config_mysql.c (original)
+++ branches/1.8/addons/res_config_mysql.c Thu May  5 15:25:52 2011
@@ -398,7 +398,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, decode_chunk(chunk), ""))) {
 							prev = prev->next;
@@ -524,7 +524,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(decode_chunk(ast_strip(chunk)))) {
 						if (initfield && !strcmp(initfield, fields[i].name)) {
 							ast_category_rename(cat, chunk);




More information about the asterisk-commits mailing list