Index: main/manager.c =================================================================== --- main/manager.c (revision 235377) +++ main/manager.c (working copy) @@ -4283,6 +4283,10 @@ struct ast_str *buf; int i; + if (!sessions && AST_RWLIST_EMPTY(&manager_hooks)) { + return 0; + } + if (!(buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE))) { return -1; } @@ -4340,11 +4344,13 @@ ao2_iterator_destroy(&i); } - AST_RWLIST_RDLOCK(&manager_hooks); - AST_RWLIST_TRAVERSE(&manager_hooks, hook, list) { - hook->helper(category, event, ast_str_buffer(buf)); + if (!AST_RWLIST_EMPTY(&manager_hooks)) { + AST_RWLIST_RDLOCK(&manager_hooks); + AST_RWLIST_TRAVERSE(&manager_hooks, hook, list) { + hook->helper(category, event, ast_str_buffer(buf)); + } + AST_RWLIST_UNLOCK(&manager_hooks); } - AST_RWLIST_UNLOCK(&manager_hooks); return 0; }