diff --git a/apps/text_editor.cpp b/apps/text_editor.cpp index 7b26ec1..92f9cd0 100644 --- a/apps/text_editor.cpp +++ b/apps/text_editor.cpp @@ -406,7 +406,9 @@ void ProcessApplicationMessage(EsMessage *message) { void _start() { _init(); - EsINIState state = { (char *) EsFileReadAll(EsLiteral(SETTINGS_FILE), &state.bytes) }; + size_t settingsFileBytes = 0; + char *settingsFile = (char *) EsFileReadAll(EsLiteral(SETTINGS_FILE), &settingsFileBytes); + EsINIState state = { .buffer = settingsFile, .bytes = settingsFileBytes }; while (EsINIParse(&state)) { if (0 == EsStringCompareRaw(state.section, state.sectionBytes, EsLiteral("general"))) { @@ -416,7 +418,7 @@ void _start() { } } - EsHeapFree(state.buffer); + EsHeapFree(settingsFile); while (true) { ProcessApplicationMessage(EsMessageReceive());