@@ -75,9 +75,8 @@ int32_t ghost_esp_app(void* p) {
7575 state -> previous_view = 0 ;
7676 state -> came_from_settings = false;
7777
78- // Initialize essential text buffer (shared log/view buffer)
7978 state -> textBoxBuffer = malloc (TEXT_LOG_BUFFER_SIZE );
80- if (state -> textBoxBuffer ) {
79+ if (state && state -> textBoxBuffer ) {
8180 memset (state -> textBoxBuffer , 0 , TEXT_LOG_BUFFER_SIZE );
8281 }
8382 state -> buffer_length = 0 ;
@@ -147,16 +146,13 @@ int32_t ghost_esp_app(void* p) {
147146 }
148147
149148 // Initialize filter config
150- state -> filter_config = malloc (sizeof (FilterConfig ));
151- if (state -> filter_config ) {
152- state -> filter_config -> enabled = state -> settings .enable_filtering_index ;
153- state -> filter_config -> show_ble_status = true;
154- state -> filter_config -> show_wifi_status = true;
155- state -> filter_config -> show_flipper_devices = true;
156- state -> filter_config -> show_wifi_networks = true;
157- state -> filter_config -> strip_ansi_codes = true;
158- state -> filter_config -> add_prefixes = true;
159- }
149+ state -> filter_config .enabled = state -> settings .enable_filtering_index ;
150+ state -> filter_config .show_ble_status = true;
151+ state -> filter_config .show_wifi_status = true;
152+ state -> filter_config .show_flipper_devices = true;
153+ state -> filter_config .show_wifi_networks = true;
154+ state -> filter_config .strip_ansi_codes = true;
155+ state -> filter_config .add_prefixes = true;
160156
161157 // Set up settings UI context
162158 state -> settings_ui_context .settings = & state -> settings ;
@@ -295,6 +291,7 @@ int32_t ghost_esp_app(void* p) {
295291 // Clean up UART context (this will also handle storage cleanup)
296292 if (state && state -> uart_context ) {
297293 FURI_LOG_I ("Ghost_ESP" , "Freeing UART context..." );
294+ uart_cleanup_capture_streams (state -> uart_context ); // Ensure capture streams are freed
298295 uart_free (state -> uart_context );
299296 state -> uart_context = NULL ;
300297 FURI_LOG_I ("Ghost_ESP" , "UART context freed." );
@@ -376,7 +373,7 @@ int32_t ghost_esp_app(void* p) {
376373 FURI_LOG_I ("Ghost_ESP" , "Freeing buffers..." );
377374 if (state && state -> input_buffer ) free (state -> input_buffer );
378375 if (state && state -> textBoxBuffer ) free (state -> textBoxBuffer );
379- if ( state && state -> filter_config ) free ( state -> filter_config );
376+ // state->filter_config is now embedded, no need to free
380377 if (state && state -> ir_file_buffer ) free (state -> ir_file_buffer );
381378 if (state && state -> active_confirm_context ) {
382379 FURI_LOG_I ("Ghost_ESP" , "Freeing active confirmation context..." );
0 commit comments