[Asterisk-code-review] res odbc: Allow unload at shutdown. (asterisk[16])
Corey Farrell
asteriskteam at digium.com
Wed Aug 15 11:32:11 CDT 2018
Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/9875
Change subject: res_odbc: Allow unload at shutdown.
......................................................................
res_odbc: Allow unload at shutdown.
This makes it possible for REF_DEBUG to report no leaks when loading
res_odbc.
Change-Id: I1a3dea786bd6e7f4820a6dd5cbaa197fa783ce93
---
M res/res_odbc.c
1 file changed, 12 insertions(+), 4 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/9875/1
diff --git a/res/res_odbc.c b/res/res_odbc.c
index 3ee8cba..b4c1585 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -996,17 +996,25 @@
static int unload_module(void)
{
- /* Prohibit unloading */
- return -1;
+ ao2_cleanup(class_container);
+ ast_cli_unregister_multiple(cli_odbc, ARRAY_LEN(cli_odbc));
+
+ return 0;
}
static int load_module(void)
{
- if (!(class_container = ao2_container_alloc(1, null_hash_fn, ao2_match_by_addr)))
+ if (!(class_container = ao2_container_alloc(1, null_hash_fn, ao2_match_by_addr))) {
return AST_MODULE_LOAD_DECLINE;
- if (load_odbc_config() == -1)
+ }
+
+ if (load_odbc_config() == -1) {
return AST_MODULE_LOAD_DECLINE;
+ }
+
+ ast_module_shutdown_ref(ast_module_info->self);
ast_cli_register_multiple(cli_odbc, ARRAY_LEN(cli_odbc));
+
return AST_MODULE_LOAD_SUCCESS;
}
--
To view, visit https://gerrit.asterisk.org/9875
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a3dea786bd6e7f4820a6dd5cbaa197fa783ce93
Gerrit-Change-Number: 9875
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180815/ed3475b2/attachment.html>
More information about the asterisk-code-review
mailing list