]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5568 --resolve the real problem is that L=-1 is not valid because the L param...
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 2 Jul 2013 13:44:47 +0000 (08:44 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 2 Jul 2013 13:44:47 +0000 (08:44 -0500)
libs/freetdm/src/libteletone_generate.c
libs/libteletone/src/libteletone_generate.c

index 3654d1ec346191c2f49d58720ad8f8f59639410e..ef7a7e03ec89da760600e42279fc4e7ff6701a03 100644 (file)
@@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
                                        break;
                                case 'L':
                                        if (!LOOPING) {
-                                               ts->LOOPS = atoi(cur + 2); 
+                                               int L;
+                                               if ((L = atoi(cur + 2)) > 0) {
+                                                       ts->LOOPS = L;
+                                                       LOOPING++;
+                                               }
                                        }
-                                       LOOPING++;
                                        break;
                                }
                        } else {
@@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
        bottom:
                free(data);
                data = NULL;
+
                if (ts->LOOPS > 0) {
                        ts->LOOPS--;
                }
index 3654d1ec346191c2f49d58720ad8f8f59639410e..ef7a7e03ec89da760600e42279fc4e7ff6701a03 100644 (file)
@@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
                                        break;
                                case 'L':
                                        if (!LOOPING) {
-                                               ts->LOOPS = atoi(cur + 2); 
+                                               int L;
+                                               if ((L = atoi(cur + 2)) > 0) {
+                                                       ts->LOOPS = L;
+                                                       LOOPING++;
+                                               }
                                        }
-                                       LOOPING++;
                                        break;
                                }
                        } else {
@@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
        bottom:
                free(data);
                data = NULL;
+
                if (ts->LOOPS > 0) {
                        ts->LOOPS--;
                }