From 34406f06070f24419c31e1391b723fed3152bae3 Mon Sep 17 00:00:00 2001 From: DerSkythe Date: Tue, 11 Oct 2022 21:09:41 +0400 Subject: [PATCH] flipper_format_free after all and only if we failed with all plans --- applications/main/subghz/subghz_history.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/applications/main/subghz/subghz_history.c b/applications/main/subghz/subghz_history.c index 961be06ad..628adc158 100644 --- a/applications/main/subghz/subghz_history.c +++ b/applications/main/subghz/subghz_history.c @@ -445,6 +445,10 @@ bool subghz_history_add_to_history( // Plan B! subghz_history_tmp_write_file_full(instance, item, dir_path); } + if (item->is_file) { + flipper_format_free(item->flipper_string); + item->flipper_string = NULL; + } furi_string_free(filename); furi_string_free(dir_path); @@ -857,9 +861,8 @@ bool subghz_history_tmp_write_file_split( flipper_format_file_close(flipper_format_file); flipper_format_free(flipper_format_file); furi_string_free(temp_str); - flipper_format_free(item->flipper_string); - item->flipper_string = NULL; - item->is_file = true; + + item->is_file = result; return result; } @@ -876,8 +879,6 @@ void subghz_history_tmp_write_file_full( stream_rewind(dst); if(stream_save_to_file( dst, instance->storage, furi_string_get_cstr(dir_path), FSOM_CREATE_ALWAYS) > 0) { - flipper_format_free(item->flipper_string); - item->flipper_string = NULL; #ifdef FURI_DEBUG FURI_LOG_I(TAG, "Save done!"); #endif