Prechádzať zdrojové kódy

free logs once written. Check length of logs.

bigbrodude6119 2 rokov pred
rodič
commit
8e2487bf86

+ 1 - 0
evil_portal_uart.c

@@ -81,6 +81,7 @@ static int32_t uart_worker(void *context) {
           strcat(uart->app->portal_logs, (char *)uart->rx_buf);
           if (strlen(uart->app->portal_logs) > 4000) {
             write_logs(uart->app->portal_logs);
+            free(uart->app->portal_logs);
           }
         }
       }

+ 4 - 1
scenes/evil_portal_scene_console_output.c

@@ -54,7 +54,10 @@ void evil_portal_scene_console_output_on_enter(void *context) {
       const char *help_msg = "Logs saved.\n\n";
       furi_string_cat_str(app->text_box_store, help_msg);
       app->text_box_store_strlen += strlen(help_msg);
-      write_logs(app->portal_logs);
+      if(strlen(app->portal_logs) > 0) {
+        write_logs(app->portal_logs);
+        free(app->portal_logs);
+      }      
       if (app->show_stopscan_tip) {
         const char *msg = "Press BACK to return\n";
         furi_string_cat_str(app->text_box_store, msg);