epollop->epfd = epfd;
/* Initialize fields */
- epollop->events = mm_malloc(INITIAL_NEVENT * sizeof(struct epoll_event));
+ epollop->events = mm_calloc(INITIAL_NEVENT, sizeof(struct epoll_event));
if (epollop->events == NULL) {
mm_free(epollop);
return (NULL);
server_req->base.flags = flags;
server_req->base.nquestions = 0;
- server_req->base.questions = mm_malloc(sizeof(struct evdns_server_question *) * questions);
+ server_req->base.questions = mm_calloc(sizeof(struct evdns_server_question *), questions);
if (server_req->base.questions == NULL)
goto err;
maxinflight = 1;
n_heads = (maxinflight+4) / 5;
EVUTIL_ASSERT(n_heads > 0);
- new_heads = mm_malloc(n_heads * sizeof(struct evdns_request*));
+ new_heads = mm_calloc(n_heads, sizeof(struct evdns_request*));
if (!new_heads)
return (-1);
- for (i=0; i < n_heads; ++i)
- new_heads[i] = NULL;
if (old_heads) {
for (i = 0; i < old_n_heads; ++i) {
while (old_heads[i]) {
}
/* allocate one more than we need for the NULL pointer */
- tmp = mm_malloc((i + 1) * sizeof(char *));
+ tmp = mm_calloc((i + 1), sizeof(char *));
if (tmp == NULL)
return (NULL);
kqueueop->pid = getpid();
/* Initialize fields */
- kqueueop->changes = mm_malloc(NEVENT * sizeof(struct kevent));
+ kqueueop->changes = mm_calloc(NEVENT, sizeof(struct kevent));
if (kqueueop->changes == NULL)
goto err;
- kqueueop->pend_changes = mm_malloc(NEVENT * sizeof(struct kevent));
+ kqueueop->pend_changes = mm_calloc(NEVENT, sizeof(struct kevent));
if (kqueueop->pend_changes == NULL)
goto err;
- kqueueop->events = mm_malloc(NEVENT * sizeof(struct kevent));
+ kqueueop->events = mm_calloc(NEVENT, sizeof(struct kevent));
if (kqueueop->events == NULL)
goto err;
kqueueop->events_size = kqueueop->changes_size =