From b6ee5c9bc77137589fb26650bb28b961b21c05b9 Mon Sep 17 00:00:00 2001 From: George Sokianos Date: Fri, 1 Sep 2023 20:11:11 +0000 Subject: [PATCH] Fixed memory leaks and lists overflows --- CHANGELOG.md | 5 +++++ Makefile.docker | 9 +++++++++ src/fsfuncs.c | 1 + src/funcs.c | 2 ++ src/iGameGUI.h | 2 +- src/iGameMain.c | 14 +++++++------- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d803566..b5f6c63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ ## iGame VERSION_TAG - [RELEASE_DATE] +### Fixed +- Fixed memory leaks +- Fixed the lists getting wrong values when overflow + +## iGame 2.4.2 - [2023-08-27] ### Changed - Simplified the version string and added the release date in the screen title diff --git a/Makefile.docker b/Makefile.docker index 3bc2826..9872427 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -78,11 +78,19 @@ ifneq (,$(filter MOS,$(CPU))) CFLAGS += +morphos -DCPU_VERS=MorphOS -D__morphos__ endif +ifeq ($(DEBUG), 1) +CFLAGS += -g -hunkdebug +endif + ########################################################################## # Linker settings ########################################################################## LIBFLAGS = -lamiga +ifeq ($(DEBUG), 1) +LIBFLAGS += -g -Bamigahunk +endif + ifneq (,$(filter 000 030 040 060,$(CPU))) LIBFLAGS += +aos68k -o endif @@ -93,6 +101,7 @@ ifneq (,$(filter MOS,$(CPU))) LIBFLAGS += +morphos -o endif + ########################################################################## # Object files which are part of iGame ########################################################################## diff --git a/src/fsfuncs.c b/src/fsfuncs.c index 6cea2e6..99a9651 100644 --- a/src/fsfuncs.c +++ b/src/fsfuncs.c @@ -707,6 +707,7 @@ void getIGameDataInfo(char *igameDataPath, slavesList *node) { strncpy(node->path, tmpTbl[1], MAX_PATH_SIZE); } + free(tmpTbl); } } diff --git a/src/funcs.c b/src/funcs.c index 2d50e1f..e6d6642 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -893,6 +893,7 @@ static BOOL examineFolder(char *path) { getIGameDataInfo(igameDataPath, node); } + free(igameDataPath); } // Generate title and add in the list @@ -930,6 +931,7 @@ static BOOL examineFolder(char *path) { getIGameDataInfo(igameDataPath, node); } + free(igameDataPath); if (!isStringEmpty(node->genre)) strncpy(existingNode->genre, node->genre, MAX_GENRE_NAME_SIZE); diff --git a/src/iGameGUI.h b/src/iGameGUI.h index a2fb3b2..75713df 100644 --- a/src/iGameGUI.h +++ b/src/iGameGUI.h @@ -94,7 +94,7 @@ struct ObjApp CONST_STRPTR STR_TX_PropertiesSlavePath; CONST_STRPTR STR_TX_PropertiesTooltypes; CONST_STRPTR STR_TX_About; - CONST_STRPTR CY_PropertiesGenreContent[128]; + CONST_STRPTR CY_PropertiesGenreContent[256]; CONST_STRPTR CY_ScreenshotSizeContent[4]; CONST_STRPTR RA_TitlesFromContent[3]; CONST_STRPTR CY_FilterListContent[6]; diff --git a/src/iGameMain.c b/src/iGameMain.c index ee4053d..b6aca16 100644 --- a/src/iGameMain.c +++ b/src/iGameMain.c @@ -260,7 +260,7 @@ static int initLibraries(void) { #ifdef __amigaos4__ IMUIMaster = (struct MUIMasterIFace *)GetInterface(MUIMasterBase, "main", 1, NULL); - if(!IMUIMaster) return clean_exit("Can't open muimaster Interface"); + if(!IMUIMaster) return clean_exit("Can't open muimaster Interface\n"); #endif } else return clean_exit("Can't open muimaster.library v19\n"); @@ -284,7 +284,7 @@ static int initLibraries(void) { #ifdef __amigaos4__ IIcon = (struct IconIFace *)GetInterface( IconBase, "main", 1, NULL ); - if(!IIcon) return clean_exit("Can't open icon.library Interface"); + if(!IIcon) return clean_exit("Can't open icon.library Interface\n"); #endif } else return clean_exit("Can't open icon.library v37 or greater\n"); @@ -297,7 +297,7 @@ static int initLibraries(void) { #ifdef __amigaos4__ IIntuition = (struct IntuitionIFace *)GetInterface( IntuitionBase, "main", 1, NULL ); - if(!IIntuition) return clean_exit("Can't open intuition.library Interface"); + if(!IIntuition) return clean_exit("Can't open intuition.library Interface\n"); #endif } else return clean_exit("Can't open intuition.library v37 or greater\n"); @@ -306,7 +306,7 @@ static int initLibraries(void) { #ifdef __amigaos4__ IGraphics = (struct GraphicsIFace *)GetInterface( GfxBase, "main", 1, NULL ); - if(!IGraphics) return clean_exit("Can't open graphics.library Interface"); + if(!IGraphics) return clean_exit("Can't open graphics.library Interface\n"); #endif } else return clean_exit("Can't open graphics.library v37 or greater\n"); @@ -315,7 +315,7 @@ static int initLibraries(void) { #ifdef __amigaos4__ IWorkbench = (struct WorkbenchIFace *)GetInterface( WorkbenchBase, "main", 1, NULL ); - if(!IWorkbench) return clean_exit("Can't open workbench.library Interface"); + if(!IWorkbench) return clean_exit("Can't open workbench.library Interface\n"); #endif } else return clean_exit("Can't open workbench.library v37 or greater\n"); @@ -324,7 +324,7 @@ static int initLibraries(void) { #ifdef __amigaos4__ IDataTypes = (struct DataTypesIFace *)GetInterface( DataTypesBase, "main", 1, NULL ); - if(!IDataTypes) return clean_exit("Can't open datatypes.library Interface"); + if(!IDataTypes) return clean_exit("Can't open datatypes.library Interface\n"); #endif } else return clean_exit("Can't open datatypes.library v37 or greater\n"); @@ -333,7 +333,7 @@ static int initLibraries(void) { #ifdef __amigaos4__ IUtility = (struct UtilityIFace *)GetInterface( UtilityBase, "main", 1, NULL ); - if(!IUtility) return clean_exit("Can't open Utility.library Interface"); + if(!IUtility) return clean_exit("Can't open Utility.library Interface\n"); #endif } else return clean_exit("Can't open utility.library v37 or greater\n");