malloc to calloc
This commit is contained in:
@@ -1080,8 +1080,7 @@ threec501_nic_init(UNUSED(const device_t *info))
|
||||
uint32_t mac;
|
||||
threec501_t *dev;
|
||||
|
||||
dev = malloc(sizeof(threec501_t));
|
||||
memset(dev, 0x00, sizeof(threec501_t));
|
||||
dev = calloc(1, sizeof(threec501_t));
|
||||
dev->maclocal[0] = 0x02; /* 02:60:8C (3Com OID) */
|
||||
dev->maclocal[1] = 0x60;
|
||||
dev->maclocal[2] = 0x8C;
|
||||
|
||||
@@ -573,8 +573,7 @@ threec503_nic_init(UNUSED(const device_t *info))
|
||||
uint32_t mac;
|
||||
threec503_t *dev;
|
||||
|
||||
dev = malloc(sizeof(threec503_t));
|
||||
memset(dev, 0x00, sizeof(threec503_t));
|
||||
dev = calloc(1, sizeof(threec503_t));
|
||||
dev->maclocal[0] = 0x02; /* 02:60:8C (3Com OID) */
|
||||
dev->maclocal[1] = 0x60;
|
||||
dev->maclocal[2] = 0x8C;
|
||||
|
||||
@@ -918,8 +918,7 @@ dp8390_set_defaults(dp8390_t *dev, uint8_t flags)
|
||||
void
|
||||
dp8390_mem_alloc(dp8390_t *dev, uint32_t start, uint32_t size)
|
||||
{
|
||||
dev->mem = (uint8_t *) malloc(size * sizeof(uint8_t));
|
||||
memset(dev->mem, 0, size * sizeof(uint8_t));
|
||||
dev->mem = (uint8_t *) calloc(size, sizeof(uint8_t));
|
||||
dev->mem_start = start;
|
||||
dev->mem_end = start + size;
|
||||
dev->mem_size = size;
|
||||
@@ -1007,8 +1006,7 @@ dp8390_soft_reset(dp8390_t *dev)
|
||||
static void *
|
||||
dp8390_init(UNUSED(const device_t *info))
|
||||
{
|
||||
dp8390_t *dp8390 = (dp8390_t *) malloc(sizeof(dp8390_t));
|
||||
memset(dp8390, 0, sizeof(dp8390_t));
|
||||
dp8390_t *dp8390 = (dp8390_t *) calloc(1, sizeof(dp8390_t));
|
||||
|
||||
/* Set values assuming WORD and only the clear IRQ flag -
|
||||
- the NIC can then call dp8390_set_defaults() again to
|
||||
|
||||
@@ -912,15 +912,13 @@ nic_init(const device_t *info)
|
||||
{
|
||||
uint32_t mac;
|
||||
uint32_t mac_oui;
|
||||
char *rom;
|
||||
char *rom = NULL;
|
||||
nic_t *dev;
|
||||
int set_oui = 0;
|
||||
|
||||
dev = malloc(sizeof(nic_t));
|
||||
memset(dev, 0x00, sizeof(nic_t));
|
||||
dev = calloc(1, sizeof(nic_t));
|
||||
dev->name = info->name;
|
||||
dev->board = info->local;
|
||||
rom = NULL;
|
||||
|
||||
if (dev->board >= NE2K_RTL8019AS) {
|
||||
dev->base_address = 0x340;
|
||||
|
||||
@@ -2916,8 +2916,7 @@ pcnet_init(const device_t *info)
|
||||
int c;
|
||||
uint16_t checksum;
|
||||
|
||||
dev = malloc(sizeof(nic_t));
|
||||
memset(dev, 0x00, sizeof(nic_t));
|
||||
dev = calloc(1, sizeof(nic_t));
|
||||
dev->name = info->name;
|
||||
dev->board = info->local & 0xff;
|
||||
|
||||
|
||||
@@ -445,8 +445,7 @@ plip_rx(void *priv, uint8_t *buf, int io_len)
|
||||
static void *
|
||||
plip_lpt_init(void *lpt)
|
||||
{
|
||||
plip_t *dev = (plip_t *) malloc(sizeof(plip_t));
|
||||
memset(dev, 0, sizeof(plip_t));
|
||||
plip_t *dev = (plip_t *) calloc(1, sizeof(plip_t));
|
||||
|
||||
plip_log(1, "PLIP: lpt_init()\n");
|
||||
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -651,8 +651,7 @@ wd_init(const device_t *info)
|
||||
uint32_t mac;
|
||||
wd_t *dev;
|
||||
|
||||
dev = malloc(sizeof(wd_t));
|
||||
memset(dev, 0x00, sizeof(wd_t));
|
||||
dev = calloc(1, sizeof(wd_t));
|
||||
dev->name = info->name;
|
||||
dev->board = info->local;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user