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: https://origsvn.digium.com/svn/asterisk/trunk@100488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2008-01-27 22:35:29 +00:00
parent aa9c40236c
commit ac699196f5
11 changed files with 123 additions and 204 deletions

View File

@@ -35,6 +35,16 @@ extern "C" {
*/
#define SCHED_MAX_CACHE 128
#define AST_SCHED_DEL(sched, id) \
do { \
int _count = 0; \
while (id > -1 && ast_sched_del(sched, id) && _count++ < 10) \
usleep(1); \
if (_count == 10) \
ast_log(LOG_WARNING, "Unable to cancel schedule ID %d. This is probably a bug (%s: %s, line %d).\n", id, __FILE__, __PRETTY_FUNCTION__, __LINE__); \
id = -1; \
} while (0);
struct sched_context;
/*! \brief New schedule context