summaryrefslogtreecommitdiff
path: root/main/manager.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-11-04 03:10:21 +0000
committerMatthew Jordan <mjordan@digium.com>2012-11-04 03:10:21 +0000
commitb6bac916f060f71c84e040ea01bed287e6990c5c (patch)
tree87c090307b75da12782ce3f81db5214a93a0b9f5 /main/manager.c
parent069f5f8b93e81e005f4dd1f7be00568749dd0c51 (diff)
Don't attempt to purge sessions when no sessions exist
Manager's tcp/tls objects have a periodic function that purge old manager sessions periodically. During shutdown, the underlying container holding those sessions can be disposed of and set to NULL before the tcp/tls periodic function is stopped. If the periodic function fires, it will attempt to iterate over a NULL container. This patch checks for whether or not the sessions container exists before attempting to purge sessions out of it. If the sessions container is NULL, we simply return. Note that this error was also caught by the Asterisk Test Suite. ........ Merged revisions 375800 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 375801 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 375802 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375803 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/manager.c')
-rw-r--r--main/manager.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main/manager.c b/main/manager.c
index 69e868884..d08982571 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -5512,6 +5512,10 @@ static void purge_sessions(int n_max)
time_t now = time(NULL);
struct ao2_iterator i;
+ if (!sessions) {
+ return;
+ }
+
i = ao2_iterator_init(sessions, 0);
while ((session = ao2_iterator_next(&i)) && n_max > 0) {
ao2_lock(session);