From d325a1a43e5e43dc248f2aae5a21cf8a841a85a9 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Sun, 28 May 2023 00:25:42 +0100 Subject: [PATCH] Free file handle after elf load --- lib/flipper_application/elf/elf_file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/flipper_application/elf/elf_file.c b/lib/flipper_application/elf/elf_file.c index 0338144a9..e982e3ca1 100644 --- a/lib/flipper_application/elf/elf_file.c +++ b/lib/flipper_application/elf/elf_file.c @@ -652,7 +652,9 @@ void elf_file_free(ELFFile* elf) { free(elf->debug_link_info.debug_link); } - storage_file_free(elf->fd); + if(elf->fd != NULL) { + storage_file_free(elf->fd); + } free(elf); } @@ -783,6 +785,9 @@ ELFFileLoadStatus elf_file_load_sections(ELFFile* elf) { FURI_LOG_I(TAG, "Total size of loaded sections: %u", total_size); //-V576 } + storage_file_free(elf->fd); + elf->fd = NULL; + return status; }