diff options
author | H. Peter Anvin <hpa@smyrno.hos.anvin.org> | 2005-09-30 21:47:50 +0400 |
---|---|---|
committer | H. Peter Anvin <hpa@smyrno.hos.anvin.org> | 2005-09-30 21:47:50 +0400 |
commit | 1b4713fb9e6ec614e8dbca90b1a57d5ffa2f3fde (patch) | |
tree | 1480809bfa6d8200640b790323ec5dfd4eba1f3d | |
parent | d6b89e7bf882648c23bd7fd4598696087487329d (diff) |
Use xmalloc/xcalloc
-rw-r--r-- | daemon.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -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]; |