aboutsummaryrefslogtreecommitdiffstats
path: root/http.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-26 16:55:34 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-26 16:55:34 +0000
commit7bcebc1b466f4e5cdef5ab1ec29e71cb0024fa02 (patch)
treece32fae4bf19b740442ce8e2e1d4b1705aa286cb /http.c
parent90c64e1e8b39ebf387b351dc0c9c419b163e2620 (diff)
use ast_calloc instead of calloc, and do a little bit of tweaking on the code formatting
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@15026 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'http.c')
-rw-r--r--http.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/http.c b/http.c
index fca076327..cdcde76a8 100644
--- a/http.c
+++ b/http.c
@@ -297,23 +297,21 @@ static void *http_root(void *data)
ast_log(LOG_WARNING, "Accept failed: %s\n", strerror(errno));
continue;
}
- ser = calloc(1, sizeof(*ser));
- if (ser) {
- ser->fd = fd;
- if ((ser->f = fdopen(ser->fd, "w+"))) {
- if (ast_pthread_create(&launched, NULL, ast_httpd_helper_thread, ser)) {
- ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
- fclose(ser->f);
- free(ser);
- }
- } else {
- ast_log(LOG_WARNING, "fdopen failed!\n");
- close(ser->fd);
+ if (!(ser = ast_calloc(1, sizeof(*ser)))) {
+ close(fd);
+ continue;
+ }
+ ser->fd = fd;
+ if ((ser->f = fdopen(ser->fd, "w+"))) {
+ if (ast_pthread_create(&launched, NULL, ast_httpd_helper_thread, ser)) {
+ ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
+ fclose(ser->f);
free(ser);
}
} else {
- ast_log(LOG_WARNING, "Out of memory!\n");
- close(fd);
+ ast_log(LOG_WARNING, "fdopen failed!\n");
+ close(ser->fd);
+ free(ser);
}
}
return NULL;