diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-10-15 21:10:02 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-10-15 21:10:02 +0000 |
commit | 1d0256adbdfb1526ec508b52203cb4ff180dd81e (patch) | |
tree | 604bf23a3a199efacbe50294886ee8d729307276 /apps | |
parent | 69b9b115e20bf60d8f03d338ba8d3c7facdbd0db (diff) |
Ensure that no pending state changes are leaked when the device state change
thread gets stopped on module unload.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@85720 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_queue.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index cc4a5fa91..fbdab1bab 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -638,7 +638,7 @@ static struct { static void *device_state_thread(void *data) { - struct statechange *sc; + struct statechange *sc = NULL; while (!device_state.stop) { ast_mutex_lock(&device_state.lock); @@ -650,7 +650,7 @@ static void *device_state_thread(void *data) /* Check to see if we were woken up to see the request to stop */ if (device_state.stop) - return NULL; + break; if (!sc) continue; @@ -658,8 +658,15 @@ static void *device_state_thread(void *data) handle_statechange(sc); free(sc); + sc = NULL; } + if (sc) + free(sc); + + while ((sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry))) + free(sc); + return NULL; } |