[asterisk-commits] pbx dundi: Run cleanup on failed load. (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 11 16:54:50 CST 2016
Joshua Colp has submitted this change and it was merged.
Change subject: pbx_dundi: Run cleanup on failed load.
......................................................................
pbx_dundi: Run cleanup on failed load.
During failed startup of pbx_dundi no cleanup was performed. Add a call
to unload_module before returning AST_MODULE_LOAD_DECLINE.
ASTERISK-25677 #close
Change-Id: I8ffa226fda4365ee7068ac1f464473f1a4ebbb29
---
M pbx/pbx_dundi.c
1 file changed, 13 insertions(+), 8 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 04da247..51801f4 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -5014,30 +5014,31 @@
io = io_context_create();
sched = ast_sched_context_create();
- if (!io || !sched)
- return AST_MODULE_LOAD_DECLINE;
+ if (!io || !sched) {
+ goto declined;
+ }
- if (set_config("dundi.conf", &sin, 0))
- return AST_MODULE_LOAD_DECLINE;
+ if (set_config("dundi.conf", &sin, 0)) {
+ goto declined;
+ }
netsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
if (netsocket < 0) {
ast_log(LOG_ERROR, "Unable to create network socket: %s\n", strerror(errno));
- return AST_MODULE_LOAD_DECLINE;
+ goto declined;
}
if (bind(netsocket, (struct sockaddr *) &sin, sizeof(sin))) {
ast_log(LOG_ERROR, "Unable to bind to %s port %d: %s\n",
ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), strerror(errno));
- return AST_MODULE_LOAD_DECLINE;
+ goto declined;
}
ast_set_qos(netsocket, tos, 0, "DUNDi");
if (start_network_thread()) {
ast_log(LOG_ERROR, "Unable to start network thread\n");
- close(netsocket);
- return AST_MODULE_LOAD_DECLINE;
+ goto declined;
}
ast_cli_register_multiple(cli_dundi, ARRAY_LEN(cli_dundi));
@@ -5050,6 +5051,10 @@
ast_verb(2, "DUNDi Ready and Listening on %s port %d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
return AST_MODULE_LOAD_SUCCESS;
+
+declined:
+ unload_module();
+ return AST_MODULE_LOAD_DECLINE;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Distributed Universal Number Discovery (DUNDi)",
--
To view, visit https://gerrit.asterisk.org/1971
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8ffa226fda4365ee7068ac1f464473f1a4ebbb29
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
More information about the asterisk-commits
mailing list