mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-04 05:15:22 +00:00 
			
		
		
		
	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:
		@@ -1139,8 +1139,7 @@ static int submit_scheduled_batch(const void *data)
 | 
			
		||||
static void submit_unscheduled_batch(void)
 | 
			
		||||
{
 | 
			
		||||
	/* this is okay since we are not being called from within the scheduler */
 | 
			
		||||
	if (cdr_sched > -1)
 | 
			
		||||
		ast_sched_del(sched, cdr_sched);
 | 
			
		||||
	AST_SCHED_DEL(sched, cdr_sched);
 | 
			
		||||
	/* schedule the submission to occur ASAP (1 ms) */
 | 
			
		||||
	cdr_sched = ast_sched_add(sched, 1, submit_scheduled_batch, NULL);
 | 
			
		||||
	/* signal the do_cdr thread to wakeup early and do some work (that lazy thread ;) */
 | 
			
		||||
@@ -1332,8 +1331,7 @@ static int do_reload(int reload)
 | 
			
		||||
	batchmode = 0;
 | 
			
		||||
 | 
			
		||||
	/* don't run the next scheduled CDR posting while reloading */
 | 
			
		||||
	if (cdr_sched > -1)
 | 
			
		||||
		ast_sched_del(sched, cdr_sched);
 | 
			
		||||
	AST_SCHED_DEL(sched, cdr_sched);
 | 
			
		||||
 | 
			
		||||
	if (config) {
 | 
			
		||||
		if ((enabled_value = ast_variable_retrieve(config, "general", "enable"))) {
 | 
			
		||||
@@ -1386,7 +1384,7 @@ static int do_reload(int reload)
 | 
			
		||||
		ast_cond_init(&cdr_pending_cond, NULL);
 | 
			
		||||
		if (ast_pthread_create_background(&cdr_thread, NULL, do_cdr, NULL) < 0) {
 | 
			
		||||
			ast_log(LOG_ERROR, "Unable to start CDR thread.\n");
 | 
			
		||||
			ast_sched_del(sched, cdr_sched);
 | 
			
		||||
			AST_SCHED_DEL(sched, cdr_sched);
 | 
			
		||||
		} else {
 | 
			
		||||
			ast_cli_register(&cli_submit);
 | 
			
		||||
			ast_register_atexit(ast_cdr_engine_term);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user