patch up memory leaks.

issues 1022, 1023, and 1024
This commit is contained in:
giantpune 2009-10-16 20:08:44 +00:00
parent 981ae17a80
commit 9c7207aa79
4 changed files with 13 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -288,6 +288,7 @@ static int do_U8_archive(void)
u8 padding[32];
if (type != 0x0000) {
free(string_table);
return -2;
}
@ -295,6 +296,7 @@ static int do_U8_archive(void)
int diff = my_data_offset - current_offset;
if (diff > 32) {
free(string_table);
return -3;
}
fread(padding, 1, diff, fp);
@ -307,7 +309,9 @@ static int do_U8_archive(void)
int result;
result = write_imd5_lz77(file_data, size, name);
if(result < 0)
{free(string_table);
return result;
}
//printf(")\n");
current_offset += size;
}
@ -317,6 +321,7 @@ static int do_U8_archive(void)
dir_index--;
}
}
free(string_table);
return 0;
}
@ -399,6 +404,7 @@ void do_U8_archivebanner(FILE *fp)
dir_index--;
}
}
free(string_table);
}
int extractbnrfile(const char * filepath, const char * destpath)

View File

@ -520,6 +520,8 @@ u8 DiscMount(discHdr *header) {
memcpy(header, g_diskID, 0x60);
memcpy(g_diskID, tmpBuff, 0x60); // Put the backup back, or games won't load
free(tmpBuff);
ResumeGui();
if (dvddone != 1) {

View File

@ -286,9 +286,6 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
ISFS_Initialize();
sprintf(path,"%s/config/database.txt",bootDevice);
f = fopen(path, "r");
ret = getTitles_TypeCount(typei, &num_titles);
if (ret < 0) {
return -1;
@ -317,6 +314,9 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
memset(buffer, 0, len);
sprintf(path,"%s/config/database.txt",bootDevice);
f = fopen(path, "r");
char name[64];
while (i < (num_titles+num_sys_titles)) {
//start from the beginning of the file each loop
@ -404,7 +404,7 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
i++;
}
fclose(f);
if (f)fclose(f);
Uninstall_FromTitle(TITLE_ID(1, 0));
ISFS_Deinitialize();