Merged revisions 317370 via svnmerge from
authorSean Bright <sean@malleable.com>
Thu, 5 May 2011 20:27:25 +0000 (20:27 +0000)
committerSean Bright <sean@malleable.com>
Thu, 5 May 2011 20:27:25 +0000 (20:27 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r317370 | seanbright | 2011-05-05 16:25:52 -0400 (Thu, 05 May 2011) | 10 lines

  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
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@317377 65c4cc65-6c06-0410-ace0-fbb531ad65f3

addons/res_config_mysql.c

index 5004700..eaf7209 100644 (file)
@@ -398,7 +398,7 @@ static struct ast_variable *realtime_mysql(const char *database, const char *tab
                                } 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 @@ static struct ast_config *realtime_multi_mysql(const char *database, const char
                        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);