diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-05 15:14:30 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-05 15:14:30 +0000 |
commit | 42b0db5bbe99931ef8e6c3d1cf66a10396cc1c33 (patch) | |
tree | dd0f65e17802ea8a3f48fa9292bf2459346ed2e5 /channels | |
parent | 8efa099472b4d60a899c7c86549ecc1861e88bce (diff) |
Do not try to unregister a NULL channel tech.
Also changed load_module function to use defines rather than numbers for return values.
Issue 10651, patch by rbraun_proformatique, with additions by me.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@81523 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_phone.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 9ef4619a7..ad34d2329 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -1261,7 +1261,8 @@ static int __unload_module(void) { struct phone_pvt *p, *pl; /* First, take us out of the channel loop */ - ast_channel_unregister(cur_tech); + if (cur_tech) + ast_channel_unregister(cur_tech); if (!ast_mutex_lock(&iflock)) { /* Hangup all interfaces if they have an owner */ p = iflist; @@ -1334,7 +1335,7 @@ static int load_module(void) if (ast_mutex_lock(&iflock)) { /* It's a little silly to lock it, but we mind as well just to be sure */ ast_log(LOG_ERROR, "Unable to lock interface list???\n"); - return -1; + return AST_MODULE_LOAD_FAILURE; } v = ast_variable_browse(cfg, "interfaces"); while(v) { @@ -1350,7 +1351,7 @@ static int load_module(void) ast_config_destroy(cfg); ast_mutex_unlock(&iflock); __unload_module(); - return -1; + return AST_MODULE_LOAD_FAILURE; } } else if (!strcasecmp(v->name, "silencesupression")) { silencesupression = ast_true(v->value); @@ -1418,12 +1419,12 @@ static int load_module(void) ast_log(LOG_ERROR, "Unable to register channel class 'Phone'\n"); ast_config_destroy(cfg); __unload_module(); - return -1; + return AST_MODULE_LOAD_FAILURE; } ast_config_destroy(cfg); /* And start the monitor for the first time */ restart_monitor(); - return 0; + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Linux Telephony API Support"); |