Use xmalloc/xcalloc
This commit is contained in:
8
daemon.c
8
daemon.c
@ -463,9 +463,7 @@ static int socksetup(int port, int **socklist_p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*socklist_p = malloc(sizeof(int));
|
*socklist_p = xmalloc(sizeof(int));
|
||||||
if ( !*socklist_p )
|
|
||||||
die("memory allocation failed: %s", strerror(errno));
|
|
||||||
**socklist_p = sockfd;
|
**socklist_p = sockfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,9 +474,7 @@ static int service_loop(int socknum, int *socklist)
|
|||||||
struct pollfd *pfd;
|
struct pollfd *pfd;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pfd = calloc(socknum, sizeof(struct pollfd));
|
pfd = xcalloc(socknum, sizeof(struct pollfd));
|
||||||
if (!pfd)
|
|
||||||
die("memory allocation failed: %s", strerror(errno));
|
|
||||||
|
|
||||||
for (i = 0; i < socknum; i++) {
|
for (i = 0; i < socknum; i++) {
|
||||||
pfd[i].fd = socklist[i];
|
pfd[i].fd = socklist[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user