Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
Fix NFC Maker buffer free
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Jul 11, 2023
1 parent 4538471 commit 0e1b3f2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions applications/external/nfc_maker/scenes/nfc_maker_scene_result.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ void nfc_maker_scene_result_on_enter(void* context) {
FlipperFormat* file = flipper_format_file_alloc(furi_record_open(RECORD_STORAGE));
FuriString* path = furi_string_alloc();
furi_string_printf(path, NFC_APP_FOLDER "/%s" NFC_APP_EXTENSION, app->name_buf);

uint32_t pages = 135;
size_t size = pages * 4;
uint8_t* buf = malloc(size);
do {
if(!flipper_format_file_open_new(file, furi_string_get_cstr(path))) break;

uint32_t pages = 135;
size_t size = pages * 4;
uint8_t* buf = malloc(size);

if(!flipper_format_write_header_cstr(file, "Flipper NFC device", 3)) break;
if(!flipper_format_write_string_cstr(file, "Device type", "NTAG215")) break;

Expand Down Expand Up @@ -330,10 +330,11 @@ void nfc_maker_scene_result_on_enter(void* context) {
}
if(!ok) break;

free(buf);
success = true;

} while(false);
free(buf);

furi_string_free(path);
flipper_format_free(file);
furi_record_close(RECORD_STORAGE);
Expand Down

0 comments on commit 0e1b3f2

Please sign in to comment.