MX 2 лет назад
Родитель
Сommit
c61f86fb08

+ 3 - 0
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;

+ 1 - 0
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) {

+ 2 - 0
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.");

+ 2 - 0
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.");

+ 2 - 0
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.");

+ 3 - 0
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);
 }

+ 8 - 0
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++) {

+ 10 - 0
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);

+ 1 - 0
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);
     }

+ 2 - 0
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;
         }

+ 2 - 0
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) {