dect
/
asterisk
Archived
13
0
Fork 0

Fix a bug in AST_SCHED_REPLACE_UNREF(). The reference count of the object

_must_ be increased before creating the scheduler entry.  Otherwise, you
create a race condition where the reference count may hit zero and the
object can disappear out from under you.  This could also would have
incorrectly decreased the reference count in the case that the scheduler
add failed.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@152887 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
russell 2008-10-30 19:28:06 +00:00
parent 71dceefced
commit cebbff12f7
1 changed files with 1 additions and 2 deletions

View File

@ -113,11 +113,10 @@ extern "C" {
unrefcall; /* should ref _data! */ \
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__); \
refcall; \
id = ast_sched_add_variable(sched, when, callback, data, variable); \
if (id == -1) \
addfailcall; \
else \
refcall; \
} while (0);
#define AST_SCHED_REPLACE_UNREF(id, sched, when, callback, data, unrefcall, addfailcall, refcall) \