if (!s) {
/* Create new session */
- s = calloc(1, sizeof(struct mansession));
+ s = ast_calloc(1, sizeof(struct mansession));
+ if (!s) {
+ *status = 500;
+ goto generic_callback_out;
+ }
memcpy(&s->sin, requestor, sizeof(s->sin));
s->fd = -1;
s->waiting_thread = AST_PTHREADT_NULL;
memset(&m, 0, sizeof(m));
if (s) {
char tmp[80];
- ast_build_string(&c, &len, "Content-type: text/%s\n", contenttype[format]);
+ ast_build_string(&c, &len, "Content-type: text/%s\r\n", contenttype[format]);
sprintf(tmp, "%08lx", s->managerid);
ast_build_string(&c, &len, "%s\r\n", ast_http_setcookie("mansession_id", tmp, httptimeout, cookie, sizeof(cookie)));
if (format == FORMAT_HTML)
if (blastaway)
destroy_session(s);
+generic_callback_out:
if (*status != 200)
return ast_http_error(500, "Server Error", NULL, "Internal Server Error (out of memory)\n");
return retval;