Merge pull request #9548 from fjtrujy/ps2MemoryLeaks

[PS2] Fix memory leaks in Font and GFX Driver
This commit is contained in:
Twinaphex 2019-10-04 17:07:35 +02:00 committed by GitHub
commit 6467d24070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
BUILD_PRX = 0 BUILD_FOR_PCSX2 = 0
DEBUG = 0 DEBUG = 0
HAVE_KERNEL_PRX = 0 HAVE_KERNEL_PRX = 0
HAVE_LOGGER = 0 HAVE_LOGGER = 0
@ -45,6 +45,9 @@ LDFLAGS += -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ee/lib -L$(CD
LIBS += -lretro_ps2 -lgskit -ldmakit -lgskit_toolkit -laudsrv -lmf -lpadx -lmtap -lmc -lhdd -lsdl -lfileXio -lz LIBS += -lretro_ps2 -lgskit -ldmakit -lgskit_toolkit -laudsrv -lmf -lpadx -lmtap -lmc -lhdd -lsdl -lfileXio -lz
LIBS += -lcdvdfs -lpatches -lpoweroff LIBS += -lcdvdfs -lpatches -lpoweroff
ifeq ($(BUILD_FOR_PCSX2), 1)
RARCH_DEFINES += -DBUILD_FOR_PCSX2
endif
ifeq ($(HAVE_THREADS), 1) ifeq ($(HAVE_THREADS), 1)
RARCH_DEFINES += -DHAVE_THREADS RARCH_DEFINES += -DHAVE_THREADS

View File

@ -156,7 +156,7 @@ static void frontend_ps2_init(void *data)
int bootDeviceID; int bootDeviceID;
SifInitRpc(0); SifInitRpc(0);
#if !defined(DEBUG) #if !defined(DEBUG) || defined(BUILD_FOR_PCSX2)
/* Comment this line if you don't wanna debug the output */ /* Comment this line if you don't wanna debug the output */
while(!SifIopReset(NULL, 0)){}; while(!SifIopReset(NULL, 0)){};
#endif #endif
@ -368,7 +368,7 @@ static int frontend_ps2_parse_drive_list(void *data, bool load_content)
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx, enum_idx,
FILE_TYPE_DIRECTORY, 0, 0); FILE_TYPE_DIRECTORY, 0, 0);
#if defined(DEBUG) #if defined(DEBUG) && !defined(BUILD_FOR_PCSX2)
menu_entries_append_enum(list, menu_entries_append_enum(list,
"host:", "host:",
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),

View File

@ -99,8 +99,6 @@ static void init_ps2_video(ps2_video_t *ps2)
static void deinitTexture(GSTEXTURE *texture) static void deinitTexture(GSTEXTURE *texture)
{ {
free(texture->Mem);
free(texture->Clut);
texture->Mem = NULL; texture->Mem = NULL;
texture->Clut = NULL; texture->Clut = NULL;
} }
@ -369,6 +367,9 @@ static void ps2_gfx_free(void *data)
deinitTexture(ps2->menuTexture); deinitTexture(ps2->menuTexture);
deinitTexture(ps2->coreTexture); deinitTexture(ps2->coreTexture);
free(ps2->menuTexture);
free(ps2->coreTexture);
gsKit_deinit_global(ps2->gsGlobal); gsKit_deinit_global(ps2->gsGlobal);
free(data); free(data);

View File

@ -45,11 +45,16 @@ static u32 gsKit_fontm_clut[16] = { 0x00000000, 0x11111111, 0x22222222, 0x333333
static void deinit_texture(GSTEXTURE *texture) static void deinit_texture(GSTEXTURE *texture)
{ {
if (texture->Mem!= NULL) {
free(texture->Mem); free(texture->Mem);
free(texture->Clut);
texture->Mem = NULL; texture->Mem = NULL;
}
if (texture->Mem!= NULL) {
free(texture->Clut);
texture->Clut = NULL; texture->Clut = NULL;
} }
}
static void deinit_gsfont(GSFONTM *gsFontM) static void deinit_gsfont(GSFONTM *gsFontM)
{ {