diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-02 22:36:30 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-02 22:36:30 +0000 |
commit | 4e9e2791c28e9bf4f23c654ffd5c4c0fc43082b9 (patch) | |
tree | 96b315ea4b59c410bb9209b850554247b5cdee2d /channels/chan_unistim.c | |
parent | 3b700df38a99af00e2c2e3ebc565f6e86da4b9fe (diff) |
fix some issues with crashing on unload, when it didn't completely load cleanly
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@88409 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_unistim.c')
-rw-r--r-- | channels/chan_unistim.c | 12 |
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; } |