From 4b9bf4f5e09a6e739bbd7ebe8c7b000d3aa722dc Mon Sep 17 00:00:00 2001
From: Kirsty Tyerman <kirsty.tyerman@boeing.com>
Date: Tue, 26 Jun 2018 13:08:07 +1000
Subject: [PATCH] pbx_dundi: reordered unloading of module pbx_dundi

Destroy scheduler after peers are pruned to stop dundi crashing when
unloading module.

ASTERISK-26987
Reported-by: Kirsty Tyerman

Change-Id: Ic12e562cd90d8d813a9e97f302045091f59e3c05
---
 pbx/pbx_dundi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index e356d6fdef..a94d71cc42 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -4982,13 +4982,14 @@ static int unload_module(void)
 
 	close(netsocket);
 	io_context_destroy(io);
-	ast_sched_context_destroy(sched);
 
 	mark_mappings();
 	prune_mappings();
 	mark_peers();
 	prune_peers();
 
+	ast_sched_context_destroy(sched);
+
 	return 0;
 }
 
-- 
GitLab