From 86476c607f9b636046b39c7913edf75b850f6517 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Wed, 21 Nov 2007 23:54:12 +0000 Subject: closes issue #11285, where an unload of a module that creates a dialplan context, causes a crash when you do a 'dialplan show' of that context. This is because the registrar string is defined in the module, and the stale pointer is traversed. The reporter offered a patch that would always strdup the registrar string, which is practical, but I preferred to destroy the created contexts in each module where one is created. That seemed more symmetric. There were only 6 place in asterisk where this is done: chan_sip, chan_iax2, chan_skinny, res_features, app_dial, and app_queue. The two apps destroyed the context, but left the contexts. All is fixed now and unloads should be dialplan friendly. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89513 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'channels/chan_iax2.c') diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 6e2a0ab96..725d25758 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -11400,6 +11400,7 @@ static struct ast_cli_entry cli_iax2[] = { static int __unload_module(void) { struct iax2_thread *thread = NULL; + struct ast_context *con; int x; /* Make sure threads do not hold shared resources when they are canceled */ @@ -11465,7 +11466,11 @@ static int __unload_module(void) ao2_ref(peers, -1); ao2_ref(users, -1); - + + con = ast_context_find(regcontext); + if (con) + ast_context_destroy(con, "IAX2"); + return 0; } -- cgit v1.2.3