diff options
author | Russell Bryant <russell@russellbryant.com> | 2007-10-15 21:11:06 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2007-10-15 21:11:06 +0000 |
commit | a586d03231f79f54e8c3586ca52b11b749da9859 (patch) | |
tree | 330a497788af65f1963cccc67827507b2fb374da /apps | |
parent | 14596e404cabf694d760729dcb16b30568801b4a (diff) |
Merged revisions 85720 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r85720 | russell | 2007-10-15 16:10:02 -0500 (Mon, 15 Oct 2007) | 3 lines
Ensure that no pending state changes are leaked when the device state change
thread gets stopped on module unload.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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 3a8654b81..482200dad 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -685,7 +685,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); @@ -697,7 +697,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; @@ -705,8 +705,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; } |