Fix memory leak in the PS2 GFX and PS2 Font

This commit is contained in:
Francisco Javier Trujillo Mata 2019-09-29 22:41:51 +02:00
parent 9ea18c433b
commit c48ccdb1fc
4 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
BUILD_PRX = 0
BUILD_FOR_PCSX2 = 1
DEBUG = 0
HAVE_KERNEL_PRX = 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 += -lcdvdfs -lpatches -lpoweroff
ifeq ($(BUILD_FOR_PCSX2), 1)
RARCH_DEFINES += -DBUILD_FOR_PCSX2
endif
ifeq ($(HAVE_THREADS), 1)
RARCH_DEFINES += -DHAVE_THREADS

View File

@ -156,7 +156,7 @@ static void frontend_ps2_init(void *data)
int bootDeviceID;
SifInitRpc(0);
#if !defined(DEBUG)
#if !defined(DEBUG) || defined(BUILD_FOR_PCSX2)
/* Comment this line if you don't wanna debug the output */
while(!SifIopReset(NULL, 0)){};
#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),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
#if defined(DEBUG)
#if defined(DEBUG) && !defined(BUILD_FOR_PCSX2)
menu_entries_append_enum(list,
"host:",
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)
{
free(texture->Mem);
free(texture->Clut);
texture->Mem = NULL;
texture->Clut = NULL;
}
@ -369,6 +367,9 @@ static void ps2_gfx_free(void *data)
deinitTexture(ps2->menuTexture);
deinitTexture(ps2->coreTexture);
free(ps2->menuTexture);
free(ps2->coreTexture);
gsKit_deinit_global(ps2->gsGlobal);
free(data);

View File

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