From 72c0317f244af3c46a8c1b59ffe0cba8adc53af5 Mon Sep 17 00:00:00 2001 From: russell Date: Sun, 16 Jul 2006 19:35:09 +0000 Subject: malloc + memset to ast_calloc git-svn-id: http://svn.digium.com/svn/asterisk/trunk@37733 f38db490-d61c-443f-a65b-d21fe96a405b --- manager.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'manager.c') diff --git a/manager.c b/manager.c index eea6b6469..028c61963 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; -- cgit v1.2.3