Skip to content

Commit

Permalink
Use xmalloc/xcalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
H. Peter Anvin committed Sep 30, 2005
1 parent d6b89e7 commit 1b4713f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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];
Expand Down

0 comments on commit 1b4713f

Please sign in to comment.