use ast_calloc instead of calloc, and do a little bit of tweaking on the code formatting

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@15026 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Russell Bryant 19 years ago
parent 813ab1aff0
commit e85d63aa11

@ -297,23 +297,21 @@ static void *http_root(void *data)
ast_log(LOG_WARNING, "Accept failed: %s\n", strerror(errno)); ast_log(LOG_WARNING, "Accept failed: %s\n", strerror(errno));
continue; continue;
} }
ser = calloc(1, sizeof(*ser)); if (!(ser = ast_calloc(1, sizeof(*ser)))) {
if (ser) { close(fd);
ser->fd = fd; continue;
if ((ser->f = fdopen(ser->fd, "w+"))) { }
if (ast_pthread_create(&launched, NULL, ast_httpd_helper_thread, ser)) { ser->fd = fd;
ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno)); if ((ser->f = fdopen(ser->fd, "w+"))) {
fclose(ser->f); if (ast_pthread_create(&launched, NULL, ast_httpd_helper_thread, ser)) {
free(ser); ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
} fclose(ser->f);
} else {
ast_log(LOG_WARNING, "fdopen failed!\n");
close(ser->fd);
free(ser); free(ser);
} }
} else { } else {
ast_log(LOG_WARNING, "Out of memory!\n"); ast_log(LOG_WARNING, "fdopen failed!\n");
close(fd); close(ser->fd);
free(ser);
} }
} }
return NULL; return NULL;

Loading…
Cancel
Save