malloc to calloc

This commit is contained in:
Jasmine Iwanek
2025-01-07 00:42:06 -05:00
parent f599e72114
commit 4e6f29a7d5
183 changed files with 245 additions and 493 deletions

View File

@@ -133,7 +133,7 @@ net_slirp_clock_get_ns(UNUSED(void *opaque))
static void *
net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, UNUSED(void *opaque))
{
pc_timer_t *timer = malloc(sizeof(pc_timer_t));
pc_timer_t *timer = calloc(1, sizeof(pc_timer_t));
timer_add(timer, cb, cb_opaque, 0);
return timer;
}
@@ -422,8 +422,7 @@ net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv
#ifndef _WIN32
slirp->pfd_size = 16 * sizeof(struct pollfd);
slirp->pfd = malloc(slirp->pfd_size);
memset(slirp->pfd, 0, slirp->pfd_size);
slirp->pfd = calloc(1, slirp->pfd_size);
#endif
/* Set the IP addresses to use. */