]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't duplicate our data on the stack and just use the MYSQL_ROW directly.
authorSean Bright <sean@malleable.com>
Thu, 5 May 2011 20:25:52 +0000 (20:25 +0000)
committerSean Bright <sean@malleable.com>
Thu, 5 May 2011 20:25:52 +0000 (20:25 +0000)
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/branches/1.8@317370 65c4cc65-6c06-0410-ace0-fbb531ad65f3

addons/res_config_mysql.c

index 50047008d04360bb6f21986fbf1e8ea8d57e165a..eaf7209f93c8c130d640b039f5ea588825e41aa3 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);