summaryrefslogtreecommitdiff
path: root/res/res_agi.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-11-01 20:46:11 -0400
committerCorey Farrell <git@cfware.com>2017-11-01 19:51:31 -0500
commitec9245174871a7117289e94a07693a07544c5ba0 (patch)
tree18dda6523725ea74b948d7802e44ac9fccc7446c /res/res_agi.c
parent21b922b565bdba9254445d1002a8a077d50ebe88 (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 'res/res_agi.c')
-rw-r--r--res/res_agi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index 466063557..91f270cd9 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -4713,6 +4713,10 @@ static int load_module(void)
unload_module();
return AST_MODULE_LOAD_DECLINE;
}
+
+ /* For Optional API. */
+ ast_module_shutdown_ref(AST_MODULE_SELF);
+
return AST_MODULE_LOAD_SUCCESS;
}