Skip to content

Commit

Permalink
Merge pull request #102 from derskythe/fix-read-in-readraw-crash
Browse files Browse the repository at this point in the history
flipper_format_free after all and only if we failed with all plans
  • Loading branch information
xMasterX authored Oct 12, 2022
2 parents e1e46b8 + 34406f0 commit 80735d4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions applications/main/subghz/subghz_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,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);

Expand Down Expand Up @@ -861,9 +865,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;
}
Expand All @@ -880,8 +883,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
Expand Down

0 comments on commit 80735d4

Please sign in to comment.