summaryrefslogtreecommitdiff
path: root/channels/chan_skinny.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-06-08 11:09:22 -0400
committerCorey Farrell <git@cfware.com>2015-06-08 11:09:22 -0400
commit55c8daf88b94f74e334ab246c51bdb7b469eedc4 (patch)
tree8c79fa393e6f2427929d2f89bf0bd4ee03b25a09 /channels/chan_skinny.c
parent720251f2b80639324a37b2041997292d97858d39 (diff)
Fix unsafe uses of ast_context pointers.
Although ast_context_find, ast_context_find_or_create and ast_context_destroy perform locking of the contexts table, any context pointer can become invalid at any time that the contexts table is unlocked. This change adds locking around all complete operations involving these functions. Places where ast_context_find was followed by ast_context_destroy have been replaced with calls ast_context_destroy_by_name. ASTERISK-25094 #close Reported by: Corey Farrell Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r--channels/chan_skinny.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index be9f9b67e..3d2d2e8d1 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -2198,8 +2198,7 @@ static void cleanup_stale_contexts(char *new, char *old)
}
}
- if (stalecontext)
- ast_context_destroy(ast_context_find(stalecontext), "Skinny");
+ ast_context_destroy_by_name(stalecontext, "Skinny");
}
}
@@ -8710,7 +8709,6 @@ static int unload_module(void)
struct skinny_device *d;
struct skinny_line *l;
struct skinny_subchannel *sub;
- struct ast_context *con;
pthread_t tempthread;
ast_rtp_glue_unregister(&skinny_rtp_glue);
@@ -8771,9 +8769,7 @@ static int unload_module(void)
ast_sched_context_destroy(sched);
}
- con = ast_context_find(used_context);
- if (con)
- ast_context_destroy(con, "Skinny");
+ ast_context_destroy_by_name(used_context, "Skinny");
ao2_ref(default_cap, -1);
return 0;