aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_skinny.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-21 23:54:12 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-21 23:54:12 +0000
commitb6e2980dd6796fabc2eba42b3db8d4b57513cb12 (patch)
tree0dc51f470ca68136426e22f709f308185e6121c2 /channels/chan_skinny.c
parent150b2c22ef3891af40e92cccbe05dbd3006e99a9 (diff)
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: http://svn.digium.com/svn/asterisk/trunk@89513 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r--channels/chan_skinny.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 7640ef341..0422a2392 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -92,6 +92,7 @@ enum skinny_codecs {
static int keep_alive = 120;
static char vmexten[AST_MAX_EXTENSION]; /* Voicemail pilot number */
+static char used_context[AST_MAX_EXTENSION]; /* Voicemail pilot number */
static char regcontext[AST_MAX_CONTEXT]; /* Context for auto-extension */
static char date_format[6] = "D-M-Y";
static char version_id[16] = "P002F202";
@@ -5508,6 +5509,7 @@ static int reload_config(void)
cleanup_stale_contexts(stringp, oldregcontext);
/* Create contexts if they don't exist already */
while ((context = strsep(&stringp, "&"))) {
+ ast_copy_string(used_context, context, sizeof(used_context));
if (!ast_context_find(context))
ast_context_create(NULL, context, "Skinny");
}
@@ -5705,6 +5707,7 @@ static int unload_module(void)
struct skinny_device *d;
struct skinny_line *l;
struct skinny_subchannel *sub;
+ struct ast_context *con;
ast_mutex_lock(&sessionlock);
/* Destroy all the interfaces and free their memory */
@@ -5762,6 +5765,10 @@ static int unload_module(void)
if (sched)
sched_context_destroy(sched);
+ con = ast_context_find(used_context);
+ if (con)
+ ast_context_destroy(con, "Skinny");
+
return 0;
}