aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-11-08 18:59:20 +0000
committermnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-11-08 18:59:20 +0000
commit070f62b2a30a5835615fccb04b21569754387ac9 (patch)
tree54b8417de06ca8d591303c290b376475b280f1da
parent859dac960e02e1d313bc47f9781001f1add7e95d (diff)
Modify our handling of 491 responses to drop any pending reinvite retry scheduler entries if we get a new 491.
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: http://svn.digium.com/svn/asterisk/branches/1.4@294163 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index c6d1a8941..37206448a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -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);