[Asterisk-cvs] asterisk channel.c,1.185,1.186

kpfleming at lists.digium.com kpfleming at lists.digium.com
Fri Apr 1 15:44:56 CST 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv2333

Modified Files:
	channel.c 
Log Message:
don't take the channel list lock until we're actually ready to put the new channel into the list in ast_channel_alloc (bug #3928)


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -d -r1.185 -r1.186
--- channel.c	1 Apr 2005 17:00:50 -0000	1.185
+++ channel.c	1 Apr 2005 21:38:17 -0000	1.186
@@ -322,11 +322,9 @@
 	if (shutting_down)
 		return NULL;
 
-	ast_mutex_lock(&chlock);
 	tmp = malloc(sizeof(struct ast_channel));
 	if (!tmp) {
 		ast_log(LOG_WARNING, "Out of memory\n");
-		ast_mutex_unlock(&chlock);
 		return NULL;
 	}
 
@@ -335,7 +333,6 @@
 	if (!tmp->sched) {
 		ast_log(LOG_WARNING, "Unable to create schedule context\n");
 		free(tmp);
-		ast_mutex_unlock(&chlock);
 		return NULL;
 	}
 	
@@ -359,7 +356,6 @@
 		if (pipe(tmp->alertpipe)) {
 			ast_log(LOG_WARNING, "Alert pipe creation failed!\n");
 			free(tmp);
-			ast_mutex_unlock(&chlock);
 			return NULL;
 		} else {
 			flags = fcntl(tmp->alertpipe[0], F_GETFL);
@@ -396,6 +392,7 @@
 
 	tmp->tech = &null_tech;
 
+	ast_mutex_lock(&chlock);
 	tmp->next = channels;
 	channels = tmp;
 




More information about the svn-commits mailing list