[FL-1320] Archive: fix memory leak

This commit is contained in:
its your bedtime 2021-05-19 12:06:51 +03:00 committed by GitHub
parent c97d766e5b
commit f5f9a04fda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -462,11 +462,21 @@ static bool archive_view_input(InputEvent* event, void* context) {
void archive_free(ArchiveApp* archive) {
furi_assert(archive);
ArchiveViewModel* model = view_get_model(archive->view_archive_main);
files_array_clear(model->files);
model = NULL;
string_clear(archive->browser.name);
string_clear(archive->browser.path);
string_clear(archive->browser.text_input_buffer);
text_input_free(archive->text_input);
furi_record_close("sdcard");
archive->fs_api = NULL;
view_free(archive->view_archive_main);
view_dispatcher_remove_view(archive->view_dispatcher, ArchiveViewMain);
view_dispatcher_remove_view(archive->view_dispatcher, ArchiveViewTextInput);
@ -478,7 +488,7 @@ void archive_free(ArchiveApp* archive) {
furi_thread_free(archive->app_thread);
osMessageQueueDelete(archive->event_queue);
furi_check(osMessageQueueDelete(archive->event_queue) == osOK);
free(archive);
}