mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
isleapp: Remove that dumb use after free.
I forgot you don't specify a filename you specify a *file pointer*
This commit is contained in:
parent
43f58f04f3
commit
801d6ae748
@ -552,9 +552,7 @@ bool IsleApp::LoadConfig()
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading sane defaults");
|
||||
FILE* iniFP = fopen(iniConfig, "wb");
|
||||
|
||||
if (iniFP) {
|
||||
fclose(iniFP);
|
||||
} else {
|
||||
if (!iniFP) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to write config at '%s': %s", iniConfig, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
@ -583,7 +581,7 @@ bool IsleApp::LoadConfig()
|
||||
iniparser_set(dict, "isle:Island Quality", "1");
|
||||
iniparser_set(dict, "isle:Island Texture", "1");
|
||||
|
||||
iniparser_dump_ini(dict, iniFP);
|
||||
iniparser_dump_ini(dict, );
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "New config written at '%s'", iniConfig);
|
||||
}
|
||||
|
||||
@ -641,6 +639,7 @@ bool IsleApp::LoadConfig()
|
||||
m_savePath = new char[strlen(savePath) + 1];
|
||||
strcpy(m_savePath, savePath);
|
||||
|
||||
fclose(iniFP);
|
||||
iniparser_freedict(dict);
|
||||
delete[] iniConfig;
|
||||
SDL_free(prefPath);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user