[svn-commits] russell: trunk r88409 - /trunk/channels/chan_unistim.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 2 17:36:31 CDT 2007


Author: russell
Date: Fri Nov  2 17:36:30 2007
New Revision: 88409

URL: http://svn.digium.com/view/asterisk?view=rev&rev=88409
Log:
fix some issues with crashing on unload, when it didn't completely load cleanly

Modified:
    trunk/channels/chan_unistim.c

Modified: trunk/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=88409&r1=88408&r2=88409
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Fri Nov  2 17:36:30 2007
@@ -5619,10 +5619,13 @@
 	/*! 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 @@
 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 @@
 	monitor_thread = AST_PTHREADT_STOP;
 	ast_mutex_unlock(&monlock);
 
-	free(buff);
-	close(unistimsock);
+	if (buff)
+		free(buff);
+	if (unistimsock > -1)
+		close(unistimsock);
 
 	return 0;
 }




More information about the svn-commits mailing list