diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-04-01 21:38:17 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-04-01 21:38:17 +0000 |
commit | d40a3ddc7708392188c8dcb1a4c291256d1c48cf (patch) | |
tree | 3006da0c89814d9a665b2f0658f960932823358f /channel.c | |
parent | 91ab9652d3d72a772db69fd72ad5e38d5a960d0d (diff) |
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)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5352 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-x | channel.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -322,11 +322,9 @@ struct ast_channel *ast_channel_alloc(int needqueue) 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 @@ struct ast_channel *ast_channel_alloc(int needqueue) 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 @@ struct ast_channel *ast_channel_alloc(int needqueue) 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 @@ struct ast_channel *ast_channel_alloc(int needqueue) tmp->tech = &null_tech; + ast_mutex_lock(&chlock); tmp->next = channels; channels = tmp; |