diff --git a/apps_source_code/brainfuck/brainfuck.c b/apps_source_code/brainfuck/brainfuck.c index 68fb41c35a3..7d032d9d972 100644 --- a/apps_source_code/brainfuck/brainfuck.c +++ b/apps_source_code/brainfuck/brainfuck.c @@ -104,6 +104,9 @@ void brainfuck_free(BFApp* brainfuck) { // Scene Manager scene_manager_free(brainfuck->scene_manager); + // Free file path + furi_string_free(brainfuck->BF_file_path); + // GUI furi_record_close(RECORD_GUI); brainfuck->gui = NULL; diff --git a/apps_source_code/brainfuck/scenes/brainfuck_scene_file_select.c b/apps_source_code/brainfuck/scenes/brainfuck_scene_file_select.c index 33c06ee810b..72c2f06d0c6 100644 --- a/apps_source_code/brainfuck/scenes/brainfuck_scene_file_select.c +++ b/apps_source_code/brainfuck/scenes/brainfuck_scene_file_select.c @@ -21,6 +21,7 @@ void brainfuck_scene_file_select_on_enter(void* context) { } else { scene_manager_search_and_switch_to_previous_scene(app->scene_manager, brainfuckSceneStart); } + furi_string_free(path); } bool brainfuck_scene_file_select_on_event(void* context, SceneManagerEvent event) { diff --git a/apps_source_code/color_guess/helpers/color_guess_storage.c b/apps_source_code/color_guess/helpers/color_guess_storage.c index 71432599212..31c79188153 100644 --- a/apps_source_code/color_guess/helpers/color_guess_storage.c +++ b/apps_source_code/color_guess/helpers/color_guess_storage.c @@ -92,8 +92,10 @@ void color_guess_read_settings(void* context) { FURI_LOG_E(TAG, "Missing Header Data"); color_guess_close_config_file(fff_file); color_guess_close_storage(); + furi_string_free(temp_str); return; } + furi_string_free(temp_str); if(file_version < COLOR_GUESS_SETTINGS_FILE_VERSION) { FURI_LOG_I(TAG, "old config version, will be removed."); diff --git a/base_pack/camera_suite/helpers/camera_suite_storage.c b/base_pack/camera_suite/helpers/camera_suite_storage.c index 5b604c02755..712346d43b1 100644 --- a/base_pack/camera_suite/helpers/camera_suite_storage.c +++ b/base_pack/camera_suite/helpers/camera_suite_storage.c @@ -93,8 +93,10 @@ void camera_suite_read_settings(void* context) { FURI_LOG_E(TAG, "Missing Header Data"); camera_suite_close_config_file(fff_file); camera_suite_close_storage(); + furi_string_free(temp_str); return; } + furi_string_free(temp_str); if(file_version < BOILERPLATE_SETTINGS_FILE_VERSION) { FURI_LOG_I(TAG, "old config version, will be removed."); diff --git a/base_pack/hex_viewer/helpers/hex_viewer_storage.c b/base_pack/hex_viewer/helpers/hex_viewer_storage.c index b7eb6b0c4b1..0b795bc5fb0 100644 --- a/base_pack/hex_viewer/helpers/hex_viewer_storage.c +++ b/base_pack/hex_viewer/helpers/hex_viewer_storage.c @@ -93,8 +93,10 @@ void hex_viewer_read_settings(void* context) { FURI_LOG_E(TAG, "Missing Header Data"); hex_viewer_close_config_file(fff_file); hex_viewer_close_storage(); + furi_string_free(temp_str); return; } + furi_string_free(temp_str); if(file_version < HEX_VIEWER_SETTINGS_FILE_VERSION) { FURI_LOG_I(TAG, "old config version, will be removed."); diff --git a/base_pack/lightmeter/lightmeter.c b/base_pack/lightmeter/lightmeter.c index 9589e025b4d..86eab916f06 100644 --- a/base_pack/lightmeter/lightmeter.c +++ b/base_pack/lightmeter/lightmeter.c @@ -139,6 +139,9 @@ void lightmeter_app_free(LightMeterApp* app) { bh1750_set_power_state(0); + // Free cfg path string + furi_string_free(app->cfg_path); + free(app->config); free(app); } diff --git a/base_pack/unitemp/Sensors.c b/base_pack/unitemp/Sensors.c index 33dd3fa88ac..515613b191d 100644 --- a/base_pack/unitemp/Sensors.c +++ b/base_pack/unitemp/Sensors.c @@ -292,6 +292,8 @@ bool unitemp_sensors_load(void) { //Открытие потока к файлу с датчиками if(!file_stream_open( app->file_stream, furi_string_get_cstr(filepath), FSAM_READ_WRITE, FSOM_OPEN_EXISTING)) { + // Free file path string if we got an error + furi_string_free(filepath); if(file_stream_get_error(app->file_stream) == FSE_NOT_EXIST) { FURI_LOG_W(APP_NAME, "Missing sensors file"); //Закрытие потока и освобождение памяти @@ -309,6 +311,8 @@ bool unitemp_sensors_load(void) { return false; } } + // Free file path string if we successfully opened the file + furi_string_free(filepath); //Вычисление размера файла uint16_t file_size = stream_size(app->file_stream); @@ -402,6 +406,8 @@ bool unitemp_sensors_save(void) { //Открытие потока if(!file_stream_open( app->file_stream, furi_string_get_cstr(filepath), FSAM_READ_WRITE, FSOM_CREATE_ALWAYS)) { + // Free file path string if we got an error + furi_string_free(filepath); FURI_LOG_E( APP_NAME, "An error occurred while saving the sensors file: %d", @@ -411,6 +417,8 @@ bool unitemp_sensors_save(void) { stream_free(app->file_stream); return false; } + // Free file path string if we successfully opened the file + furi_string_free(filepath); //Сохранение датчиков for(uint8_t i = 0; i < unitemp_sensors_getActiveCount(); i++) { diff --git a/base_pack/unitemp/unitemp.c b/base_pack/unitemp/unitemp.c index 9fa3b703857..44b808473b8 100644 --- a/base_pack/unitemp/unitemp.c +++ b/base_pack/unitemp/unitemp.c @@ -79,6 +79,8 @@ bool unitemp_saveSettings(void) { //Открытие потока if(!file_stream_open( app->file_stream, furi_string_get_cstr(filepath), FSAM_READ_WRITE, FSOM_CREATE_ALWAYS)) { + // Free file path string if we got an error + furi_string_free(filepath); FURI_LOG_E( APP_NAME, "An error occurred while saving the settings file: %d", @@ -99,6 +101,8 @@ bool unitemp_saveSettings(void) { //Закрытие потока и освобождение памяти file_stream_close(app->file_stream); stream_free(app->file_stream); + // Free file path string if we successfully opened the file + furi_string_free(filepath); FURI_LOG_I(APP_NAME, "Settings have been successfully saved"); return true; @@ -124,6 +128,8 @@ bool unitemp_loadSettings(void) { //Закрытие потока и освобождение памяти file_stream_close(app->file_stream); stream_free(app->file_stream); + // Free file path string if we got an error + furi_string_free(filepath); //Сохранение стандартного конфига unitemp_saveSettings(); return false; @@ -135,9 +141,13 @@ bool unitemp_loadSettings(void) { //Закрытие потока и освобождение памяти file_stream_close(app->file_stream); stream_free(app->file_stream); + // Free file path string if we got an error + furi_string_free(filepath); return false; } } + // Free file path string if we successfully opened the file + furi_string_free(filepath); //Вычисление размера файла uint8_t file_size = stream_size(app->file_stream); diff --git a/non_catalog_apps/coffee_eeprom/coffee.c b/non_catalog_apps/coffee_eeprom/coffee.c index 6c61131cf24..3ff367b697e 100644 --- a/non_catalog_apps/coffee_eeprom/coffee.c +++ b/non_catalog_apps/coffee_eeprom/coffee.c @@ -53,6 +53,7 @@ void dump(uint8_t* out){ } FURI_LOG_E("COFFEE_eeprom", furi_string_get_cstr(dump_str)); FURI_LOG_E("COFFEE_eeprom", "End dump"); + furi_string_free(dump_str); }else{ FURI_LOG_D("COFFEE", "DUMP: EEPROM not ready %x (8-bit)", EEPROM_I2C_ADDR); } diff --git a/non_catalog_apps/coffee_eeprom/coffee_eeprom.c b/non_catalog_apps/coffee_eeprom/coffee_eeprom.c index c3ea34d6ec3..cbb4f1e9ce9 100644 --- a/non_catalog_apps/coffee_eeprom/coffee_eeprom.c +++ b/non_catalog_apps/coffee_eeprom/coffee_eeprom.c @@ -96,6 +96,7 @@ void load_file_dump(){ if(!storage_file_open(file, furi_string_get_cstr(file_path), FSAM_READ, FSOM_OPEN_EXISTING)) { FURI_LOG_E(TAG, "Failed to open file"); } + furi_string_free(file_path); uint8_t buffer[256] = {0}; uint16_t read = 0; @@ -123,6 +124,7 @@ void load_file_dump(){ } FURI_LOG_E(TAG, "%s", furi_string_get_cstr(dump)); FURI_LOG_E(TAG, "END READ DUMP"); + furi_string_free(dump); write_dump(buffer, (size_t) read); break; } diff --git a/non_catalog_apps/sd_spi/sd_spi_app.c b/non_catalog_apps/sd_spi/sd_spi_app.c index 707685b90c0..dc87d8aff9b 100644 --- a/non_catalog_apps/sd_spi/sd_spi_app.c +++ b/non_catalog_apps/sd_spi/sd_spi_app.c @@ -329,6 +329,7 @@ void app_scene_on_enter_info(void* context) { furi_string_cat_printf(temp_str, "Github: %s\n\n", GITHUB); widget_add_text_scroll_element(app->widget_about, 0, 16, 128, 50, furi_string_get_cstr(temp_str)); + furi_string_free(temp_str); view_dispatcher_switch_to_view(app->view_dispatcher, AppView_Info); } bool app_scene_on_event_info(void* context, SceneManagerEvent event) { @@ -381,6 +382,7 @@ void app_scene_on_enter_status(void* context) { text_box_set_text(app->tb_status, furi_string_get_cstr(fs_status)); text_box_set_focus(app->tb_status, TextBoxFocusEnd); + furi_string_free(fs_status); view_dispatcher_switch_to_view(app->view_dispatcher, AppView_Status); } bool app_scene_on_event_status(void* context, SceneManagerEvent event) {