diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-15 01:48:54 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-15 01:48:54 +0000 |
commit | ea305ad5218d5105ed9d1e98d02a670e1b57e684 (patch) | |
tree | 31e620638e870c97b5d87171b5384501ffe9a14b /autoservice.c | |
parent | 039789031cfec395474770919f4ec367108abc1c (diff) |
more memory allocation wrapper conversion
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@10141 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'autoservice.c')
-rw-r--r-- | autoservice.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/autoservice.c b/autoservice.c index 08cbb4734..0859a4ab1 100644 --- a/autoservice.c +++ b/autoservice.c @@ -107,23 +107,20 @@ int ast_autoservice_start(struct ast_channel *chan) /* XXX if found, we return -1, why ??? */ /* If not, start autoservice on channel */ - if (!as) { - as = calloc(1, sizeof(struct asent)); - if (as) { - as->chan = chan; - AST_LIST_INSERT_HEAD(&aslist, as, list); - res = 0; - if (asthread == AST_PTHREADT_NULL) { /* need start the thread */ - if (ast_pthread_create(&asthread, NULL, autoservice_run, NULL)) { - ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n"); - /* There will only be a single member in the list at this point, - the one we just added. */ - AST_LIST_REMOVE(&aslist, as, list); - free(as); - res = -1; - } else - pthread_kill(asthread, SIGURG); - } + if (!as && (as = ast_calloc(1, sizeof(*as)))) { + as->chan = chan; + AST_LIST_INSERT_HEAD(&aslist, as, list); + res = 0; + if (asthread == AST_PTHREADT_NULL) { /* need start the thread */ + if (ast_pthread_create(&asthread, NULL, autoservice_run, NULL)) { + ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n"); + /* There will only be a single member in the list at this point, + the one we just added. */ + AST_LIST_REMOVE(&aslist, as, list); + free(as); + res = -1; + } else + pthread_kill(asthread, SIGURG); } } AST_LIST_UNLOCK(&aslist); |