diff options
author | Corey Farrell <git@cfware.com> | 2017-11-01 20:46:11 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2017-11-01 21:07:15 -0400 |
commit | 73a5e9f0e9600bb656c31c9a091371b495b1fb03 (patch) | |
tree | 5f888c28c5a34d6c0536e35c081219c4370433fb /funcs | |
parent | a7c00707a596d1254eab56e7f4162f78a176b42a (diff) |
Prevent unload of modules which implement an Optional API.
Once an Optional API module is loaded it should stay loaded. Unloading
an optional API module runs the risk of a crash if something else is
using it. This patch causes all optional API providers to tell the
module loader not to unload except at shutdown.
ASTERISK-27389
Change-Id: Ia07786fe655681aec49cc8d3d96e06483b11f5e6
Diffstat (limited to 'funcs')
-rw-r--r-- | funcs/func_periodic_hook.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/funcs/func_periodic_hook.c b/funcs/func_periodic_hook.c index f459e3576..0e260c9ca 100644 --- a/funcs/func_periodic_hook.c +++ b/funcs/func_periodic_hook.c @@ -490,6 +490,11 @@ static int load_module(void) res = ast_custom_function_register_escalating(&hook_function, AST_CFE_BOTH); + if (!res) { + /* For Optional API. */ + ast_module_shutdown_ref(ast_module_info->self); + } + return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS; } |