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

@@ -366,15 +366,11 @@ gameport_add(const device_t *gameport_type)
static void *
gameport_init(const device_t *info)
{
gameport_t *dev = NULL;
dev = malloc(sizeof(gameport_t));
memset(dev, 0x00, sizeof(gameport_t));
gameport_t *dev = calloc(1, sizeof(gameport_t));
/* Allocate global instance. */
if (!joystick_instance[0] && joystick_type) {
joystick_instance[0] = malloc(sizeof(joystick_instance_t));
memset(joystick_instance[0], 0x00, sizeof(joystick_instance_t));
joystick_instance[0] = calloc(1, sizeof(joystick_instance_t));
joystick_instance[0]->axis[0].joystick = joystick_instance[0];
joystick_instance[0]->axis[1].joystick = joystick_instance[0];