summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-11-02 22:36:30 +0000
committerRussell Bryant <russell@russellbryant.com>2007-11-02 22:36:30 +0000
commit286840b7cbef70ef9999d6b10ec24858bed87e5f (patch)
tree96b315ea4b59c410bb9209b850554247b5cdee2d
parenta99e6015b28406cc9be41130a06b9cb6a48ce4e9 (diff)
fix some issues with crashing on unload, when it didn't completely load cleanly
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_unistim.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 793750e51..7efd2896f 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -5619,10 +5619,13 @@ chanreg_failed:
/*! XXX \todo Leaking anything allocated by reload_config() ... */
reload_failed:
sched_context_destroy(sched);
+ sched = NULL;
sched_failed:
io_context_destroy(io);
+ io = NULL;
io_failed:
free(buff);
+ buff = NULL;
buff_failed:
return AST_MODULE_LOAD_DECLINE;
}
@@ -5630,7 +5633,8 @@ buff_failed:
static int unload_module(void)
{
/* First, take us out of the channel loop */
- sched_context_destroy(sched);
+ if (sched)
+ sched_context_destroy(sched);
ast_cli_unregister_multiple(unistim_cli, ARRAY_LEN(unistim_cli));
@@ -5646,8 +5650,10 @@ static int unload_module(void)
monitor_thread = AST_PTHREADT_STOP;
ast_mutex_unlock(&monlock);
- free(buff);
- close(unistimsock);
+ if (buff)
+ free(buff);
+ if (unistimsock > -1)
+ close(unistimsock);
return 0;
}