]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Modify our handling of 491 responses to drop any pending reinvite retry scheduler...
authorMatthew Nicholson <mnicholson@digium.com>
Mon, 8 Nov 2010 18:59:20 +0000 (18:59 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Mon, 8 Nov 2010 18:59:20 +0000 (18:59 +0000)
This prevents a scheduler entry from leaking if we receive a 491 response when one is pending.  If a scheduler entry leaks, the pvt it is associated my get destroyed before the scheduler entry fires, and then memory corruption and crashes can occur when the scheduled reinvite attempts to access and modify the memory of the destroyed pvt.

ABE-2543

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

channels/chan_sip.c

index c6d1a8941a45f6e0f6f7a34b3694f5d379f0268f..37206448a5f95c63ff54af577d79a8614cc70a2e 100644 (file)
@@ -13497,6 +13497,14 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru
                                } else {
                                        wait = ast_random() % 2000;
                                }
+
+                               if (p->waitid != -1) {
+                                       if (option_debug > 2)
+                                               ast_log(LOG_DEBUG, "Reinvite race during existing reinvite race. Abandoning previous reinvite retry.\n");
+                                       AST_SCHED_DEL(sched, p->waitid);
+                                       p->waitid = -1;
+                               }
+
                                p->waitid = ast_sched_add(sched, wait, sip_reinvite_retry, p);
                                if (option_debug > 2)
                                        ast_log(LOG_DEBUG, "Reinvite race. Waiting %d secs before retry\n", wait);