From f5e425b92aa4bb68f0419dbbe8af7fe17f9ad992 Mon Sep 17 00:00:00 2001 From: EkeEke Date: Tue, 15 Aug 2017 11:00:47 +0200 Subject: [PATCH] [Core/CD] fixed CD hardware buffer initialization when using dynamic memory allocation --- core/loadrom.c | 6 +++--- core/loadrom.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/loadrom.c b/core/loadrom.c index 0e1d4b5..c9e3b0d 100644 --- a/core/loadrom.c +++ b/core/loadrom.c @@ -3,7 +3,7 @@ * ROM Loading Support * * Copyright (C) 1998-2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -534,8 +534,8 @@ int load_rom(char *filename) #ifdef USE_DYNAMIC_ALLOC if (!ext) { - /* allocate memory for Cartridge / CD hardware if required */ - ext = (external_t *)malloc(sizeof(external_t)); + /* allocate & initialize memory for Cartridge / CD hardware if required */ + ext = (external_t *)calloc(1, sizeof(external_t)); if (!ext) return (0); } #endif diff --git a/core/loadrom.h b/core/loadrom.h index 8807034..5809a76 100644 --- a/core/loadrom.h +++ b/core/loadrom.h @@ -3,7 +3,7 @@ * ROM Loading Support * * Copyright (C) 1998-2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: