use calloc to hopefully not read random stuff

This commit is contained in:
2026-07-17 12:31:42 +10:00
parent e7350a254f
commit f786235064

View File

@@ -226,7 +226,7 @@ void startEmulator(Emulator* emu) {
} }
Emulator* initEmulator(uint32_t memorySize) { Emulator* initEmulator(uint32_t memorySize) {
Emulator* newEmu = malloc(sizeof(Emulator)); Emulator* newEmu = calloc(1, sizeof(Emulator));
if (!newEmu) if (!newEmu)
return NULL; return NULL;
@@ -256,4 +256,4 @@ void freeEmulator(Emulator* emu) {
void installDevice(Emulator* emu, Device* device, uint8_t deviceNumber) { void installDevice(Emulator* emu, Device* device, uint8_t deviceNumber) {
assert(deviceNumber < MAX_DEVICES); assert(deviceNumber < MAX_DEVICES);
emu->devices[deviceNumber] = device; emu->devices[deviceNumber] = device;
} }