diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-27 22:35:29 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-27 22:35:29 +0000 |
commit | c83caa1ae0033f53e8e51f98415a48f69fb0b349 (patch) | |
tree | 7b27e35fa085d171969d24fcc34ee5ba0350fead /channels/chan_mgcp.c | |
parent | 76bbd4b67a62edd656285e38f7e204a000d6b091 (diff) |
Merged revisions 100465 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r100465 | tilghman | 2008-01-27 15:59:53 -0600 (Sun, 27 Jan 2008) | 11 lines
When deleting a task from the scheduler, ignoring the return value could
possibly cause memory to be accessed after it is freed, which causes all
sorts of random memory corruption. Instead, if a deletion fails, wait a
bit and try again (noting that another thread could change our taskid
value).
(closes issue #11386)
Reported by: flujan
Patches:
20080124__bug11386.diff.txt uploaded by Corydon76 (license 14)
Tested by: Corydon76, flujan, stuarth`
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@100488 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r-- | channels/chan_mgcp.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 526e8e266..3e9af5734 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -3355,9 +3355,8 @@ static int mgcpsock_read(int *id, int fd, short events, void *ignore) } /* stop retrans timer if the queue is empty */ - if (!gw->msgs && (gw->retransid != -1)) { - ast_sched_del(sched, gw->retransid); - gw->retransid = -1; + if (!gw->msgs) { + AST_SCHED_DEL(sched, gw->retransid); } ast_mutex_unlock(&gw->msgs_lock); @@ -3609,9 +3608,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) } } else { /* Non-dynamic. Make sure we become that way if we're not */ - if (gw->expire > -1) - ast_sched_del(sched, gw->expire); - gw->expire = -1; + AST_SCHED_DEL(sched, gw->expire); gw->dynamic = 0; if (ast_get_ip(&gw->addr, v->value)) { if (!gw_reload) { |