diff --git a/manager.c b/manager.c index eea6b64691898337dc6cb3559875d3ae94e3c113..028c61963866e8d2b7e7fa463e7ce35b049f4c04 100644 --- a/manager.c +++ b/manager.c @@ -1909,12 +1909,9 @@ static void *accept_thread(void *ignore) ast_log(LOG_WARNING, "Failed to set manager tcp connection to TCP_NODELAY mode: %s\n", strerror(errno)); } } - s = malloc(sizeof(struct mansession)); - if (!s) { - ast_log(LOG_WARNING, "Failed to allocate management session: %s\n", strerror(errno)); + if (!(s = ast_calloc(1, sizeof(*s)))) continue; - } - memset(s, 0, sizeof(struct mansession)); + memcpy(&s->sin, &sin, sizeof(sin)); s->writetimeout = 100; s->waiting_thread = AST_PTHREADT_NULL;