]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix memory leak with DelayedRetry (issue #6157)
authorRussell Bryant <russell@russellbryant.com>
Mon, 9 Jan 2006 22:03:42 +0000 (22:03 +0000)
committerRussell Bryant <russell@russellbryant.com>
Mon, 9 Jan 2006 22:03:42 +0000 (22:03 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.0@7914 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx/pbx_spool.c

index fcf50c27112b0693e91ba936ee0031a29ae52055..b8b06ed8f8e14d4ba51ca1e6c881c81a99c502e1 100644 (file)
@@ -271,9 +271,11 @@ static int scan_service(char *fn, time_t now, time_t atime)
 #endif
                                fclose(f);
                                if (o->retries <= o->maxretries) {
+                                       now += o->retrytime;
                                        if (o->callingpid && (o->callingpid == ast_mainpid)) {
                                                safe_append(o, time(NULL), "DelayedRetry");
                                                ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
+                                               free(o);
                                        } else {
                                                /* Increment retries */
                                                o->retries++;
@@ -285,7 +287,6 @@ static int scan_service(char *fn, time_t now, time_t atime)
                                                safe_append(o, now, "StartRetry");
                                                launch_service(o);
                                        }
-                                       now += o->retrytime;
                                        return now;
                                } else {
                                        ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt(s)\n", o->tech, o->dest, o->retries - 1);