From 1b4713fb9e6ec614e8dbca90b1a57d5ffa2f3fde Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 30 Sep 2005 10:47:50 -0700 Subject: [PATCH] Use xmalloc/xcalloc --- daemon.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/daemon.c b/daemon.c index b6006c7829..6298f53fcf 100644 --- a/daemon.c +++ b/daemon.c @@ -463,9 +463,7 @@ static int socksetup(int port, int **socklist_p) return 0; } - *socklist_p = malloc(sizeof(int)); - if ( !*socklist_p ) - die("memory allocation failed: %s", strerror(errno)); + *socklist_p = xmalloc(sizeof(int)); **socklist_p = sockfd; } @@ -476,9 +474,7 @@ static int service_loop(int socknum, int *socklist) struct pollfd *pfd; int i; - pfd = calloc(socknum, sizeof(struct pollfd)); - if (!pfd) - die("memory allocation failed: %s", strerror(errno)); + pfd = xcalloc(socknum, sizeof(struct pollfd)); for (i = 0; i < socknum; i++) { pfd[i].fd = socklist[i]; -- 2.11.4.GIT