Various fixes

Stop loading themes missing smdh files - this was causing scroll crashes due to how the icon loading code was working. In the future we will include a message about how themes are skipped due to lacking smdh files. Invalid zips also caused the same issue and are also now being properly ignored

Fix memory leak in the zip file loading code
This commit is contained in:
2020-06-12 12:02:13 -04:00
parent 2c2c7f4b33
commit a4532b0f3d
2 changed files with 21 additions and 2 deletions

View File

@@ -187,9 +187,27 @@ Result load_entries(const char * loading_path, Entry_List_s * list)
if(R_FAILED(res) || entries_read == 0)
break;
if(!(dir_entry.attributes & FS_ATTRIBUTE_DIRECTORY) && strcmp(dir_entry.shortExt, "ZIP"))
if(!(dir_entry.attributes & FS_ATTRIBUTE_DIRECTORY) && strcmp(dir_entry.shortExt, "ZIP"))
continue;
u16 path[0x106] = {0};
struacat(path, loading_path);
strucat(path, dir_entry.name);
char * buf = NULL;
if (!strcmp(dir_entry.shortExt, "ZIP"))
{
u32 size = zip_file_to_buf("info.smdh", path, &buf);
if (size == 0) continue;
}
else
{
struacat(path, "/info.smdh");
u32 size = file_to_buf(fsMakePath(PATH_UTF16, path), ArchiveSD, &buf);
if (size == 0) continue;
}
free(buf);
list->entries_count++;
Entry_s * new_list = realloc(list->entries, list->entries_count * sizeof(Entry_s));
if(new_list == NULL)
@@ -645,4 +663,4 @@ Result load_audio(Entry_s entry, audio_s *audio)
DEBUG("<load_audio> fmemopen failed!\n");
return MAKERESULT(RL_FATAL, RS_NOTFOUND, RM_APPLICATION, RD_NOT_FOUND);
}
}
}