diff --git a/applications/main/unirfremix/unirfremix_app.c b/applications/main/unirfremix/unirfremix_app.c index 3968b6df6..ee5b07ece 100644 --- a/applications/main/unirfremix/unirfremix_app.c +++ b/applications/main/unirfremix/unirfremix_app.c @@ -57,7 +57,6 @@ typedef struct { FuriString* left_file; FuriString* right_file; FuriString* ok_file; - FuriString* empty; FuriString* up_l; FuriString* left_l; @@ -873,7 +872,6 @@ void unirfremix_free(UniRFRemix* app, bool with_subghz) { furi_string_free(app->left_file); furi_string_free(app->right_file); furi_string_free(app->ok_file); - furi_string_free(app->empty); furi_string_free(app->up_l); furi_string_free(app->down_l); @@ -911,6 +909,7 @@ int32_t unirfremix_app(void* p) { UniRFRemix* app = unirfremix_alloc(); app->file_path = furi_string_alloc(); + app->signal = furi_string_alloc(); //setup variables before population app->up_file = furi_string_alloc(); @@ -918,7 +917,6 @@ int32_t unirfremix_app(void* p) { app->left_file = furi_string_alloc(); app->right_file = furi_string_alloc(); app->ok_file = furi_string_alloc(); - app->empty = furi_string_alloc(); app->up_l = furi_string_alloc(); app->down_l = furi_string_alloc(); @@ -995,7 +993,7 @@ int32_t unirfremix_app(void* p) { if(input.type == InputTypePress) { if(app->up_enabled) { if(app->processing == 0) { - app->signal = app->empty; + furi_string_reset(app->signal); app->signal = app->up_file; app->button = 1; app->processing = 1; @@ -1013,7 +1011,7 @@ int32_t unirfremix_app(void* p) { if(input.type == InputTypePress) { if(app->down_enabled) { if(app->processing == 0) { - app->signal = app->empty; + furi_string_reset(app->signal); app->signal = app->down_file; app->button = 2; app->processing = 1; @@ -1031,7 +1029,7 @@ int32_t unirfremix_app(void* p) { if(input.type == InputTypePress) { if(app->right_enabled) { if(app->processing == 0) { - app->signal = app->empty; + furi_string_reset(app->signal); app->signal = app->right_file; app->button = 3; app->processing = 1; @@ -1049,7 +1047,7 @@ int32_t unirfremix_app(void* p) { if(input.type == InputTypePress) { if(app->left_enabled) { if(app->processing == 0) { - app->signal = app->empty; + furi_string_reset(app->signal); app->signal = app->left_file; app->button = 4; app->processing = 1; @@ -1067,7 +1065,7 @@ int32_t unirfremix_app(void* p) { if(input.type == InputTypePress) { if(app->ok_enabled) { if(app->processing == 0) { - app->signal = app->empty; + furi_string_reset(app->signal); app->signal = app->ok_file; app->button = 5; app->processing = 1; diff --git a/applications/plugins/flipfrid/flipfrid.c b/applications/plugins/flipfrid/flipfrid.c index 807c26659..2c5d1201d 100644 --- a/applications/plugins/flipfrid/flipfrid.c +++ b/applications/plugins/flipfrid/flipfrid.c @@ -57,6 +57,8 @@ FlipFridState* flipfrid_alloc() { FlipFridState* flipfrid = malloc(sizeof(FlipFridState)); flipfrid->notification_msg = furi_string_alloc(); flipfrid->attack_name = furi_string_alloc(); + flipfrid->proto_name = furi_string_alloc(); + flipfrid->data_str = furi_string_alloc(); flipfrid->previous_scene = NoneScene; flipfrid->current_scene = SceneEntryPoint; @@ -97,6 +99,8 @@ void flipfrid_free(FlipFridState* flipfrid) { // Strings furi_string_free(flipfrid->notification_msg); furi_string_free(flipfrid->attack_name); + furi_string_free(flipfrid->proto_name); + furi_string_free(flipfrid->data_str); free(flipfrid->data); free(flipfrid->payload); @@ -120,8 +124,7 @@ int32_t flipfrid_start(void* p) { FURI_LOG_E(TAG, "cannot create mutex\r\n"); furi_message_queue_free(event_queue); furi_record_close(RECORD_NOTIFICATION); - furi_record_close(RECORD_DIALOGS); - free(flipfrid_state); + flipfrid_free(flipfrid_state); return 255; } diff --git a/applications/plugins/flipfrid/scene/flipfrid_scene_select_field.c b/applications/plugins/flipfrid/scene/flipfrid_scene_select_field.c index 607ff4aca..79416d616 100644 --- a/applications/plugins/flipfrid/scene/flipfrid_scene_select_field.c +++ b/applications/plugins/flipfrid/scene/flipfrid_scene_select_field.c @@ -70,7 +70,7 @@ void flipfrid_center_displayed_key(FlipFridState* context, uint8_t index) { } void flipfrid_scene_select_field_on_enter(FlipFridState* context) { - furi_string_free(context->notification_msg); + furi_string_reset(context->notification_msg); } void flipfrid_scene_select_field_on_exit(FlipFridState* context) { diff --git a/applications/plugins/subbrute/subbrute_device.c b/applications/plugins/subbrute/subbrute_device.c index cfcf63e60..bd358dc7b 100644 --- a/applications/plugins/subbrute/subbrute_device.c +++ b/applications/plugins/subbrute/subbrute_device.c @@ -194,26 +194,24 @@ bool subbrute_device_create_packet_parsed(SubBruteDevice* instance, uint64_t ste //char step_payload[32]; //memset(step_payload, '0', sizeof(step_payload)); memset(instance->payload, 0, sizeof(instance->payload)); - FuriString* candidate; - candidate = furi_string_alloc(); + FuriString* candidate = furi_string_alloc(); if(instance->attack == SubBruteAttackLoadFile) { if(step >= sizeof(instance->file_key)) { return false; } char subbrute_payload_byte[4]; - furi_string_set(candidate, instance->file_key); + furi_string_set_str(candidate, instance->file_key); snprintf(subbrute_payload_byte, 4, "%02X ", (uint8_t)step); furi_string_replace_at(candidate, instance->load_index * 3, 3, subbrute_payload_byte); //snprintf(step_payload, sizeof(step_payload), "%02X", (uint8_t)instance->file_key[step]); } else { //snprintf(step_payload, sizeof(step_payload), "%16X", step); //snprintf(step_payload, sizeof(step_payload), "%016llX", step); - FuriString* buffer; - buffer = furi_string_alloc(); - buffer = furi_string_alloc_printf("%16X", step); + FuriString* buffer = furi_string_alloc(); + furi_string_printf(buffer, "%16X", step); int j = 0; - furi_string_set(candidate, " "); + furi_string_set_str(candidate, " "); for(uint8_t i = 0; i < 16; i++) { if(furi_string_get_char(buffer, i) != ' ') { furi_string_set_char(candidate, i + j, furi_string_get_char(buffer, i)); @@ -306,8 +304,8 @@ SubBruteFileResult subbrute_device_attack_set(SubBruteDevice* instance, SubBrute instance->frequency = 868350000; } instance->bit = 12; - furi_string_set(instance->protocol_name, protocol_came); - furi_string_set(instance->preset_name, preset_ook650_async); + furi_string_set_str(instance->protocol_name, protocol_came); + furi_string_set_str(instance->preset_name, preset_ook650_async); break; case SubBruteAttackChamberlain9bit300: case SubBruteAttackChamberlain9bit315: @@ -320,32 +318,32 @@ SubBruteFileResult subbrute_device_attack_set(SubBruteDevice* instance, SubBrute instance->frequency = 390000000; } instance->bit = 9; - furi_string_set(instance->protocol_name, protocol_cham_code); - furi_string_set(instance->preset_name, preset_ook650_async); + furi_string_set_str(instance->protocol_name, protocol_cham_code); + furi_string_set_str(instance->preset_name, preset_ook650_async); break; case SubBruteAttackLinear10bit300: instance->frequency = 300000000; instance->bit = 10; - furi_string_set(instance->protocol_name, protocol_linear); - furi_string_set(instance->preset_name, preset_ook650_async); + furi_string_set_str(instance->protocol_name, protocol_linear); + furi_string_set_str(instance->preset_name, preset_ook650_async); break; case SubBruteAttackLinear10bit310: instance->frequency = 310000000; instance->bit = 10; - furi_string_set(instance->protocol_name, protocol_linear); - furi_string_set(instance->preset_name, preset_ook650_async); + furi_string_set_str(instance->protocol_name, protocol_linear); + furi_string_set_str(instance->preset_name, preset_ook650_async); break; case SubBruteAttackNICE12bit433: instance->frequency = 433920000; instance->bit = 12; - furi_string_set(instance->protocol_name, protocol_nice_flo); - furi_string_set(instance->preset_name, preset_ook650_async); + furi_string_set_str(instance->protocol_name, protocol_nice_flo); + furi_string_set_str(instance->preset_name, preset_ook650_async); break; case SubBruteAttackNICE12bit868: instance->frequency = 868350000; instance->bit = 12; - furi_string_set(instance->protocol_name, protocol_nice_flo); - furi_string_set(instance->preset_name, preset_ook650_async); + furi_string_set_str(instance->protocol_name, protocol_nice_flo); + furi_string_set_str(instance->preset_name, preset_ook650_async); break; default: FURI_LOG_E(TAG, "Unknown attack type: %d", type); diff --git a/applications/plugins/subbrute/views/subbrute_main_view.c b/applications/plugins/subbrute/views/subbrute_main_view.c index a5a67d2fa..a9974ced1 100644 --- a/applications/plugins/subbrute/views/subbrute_main_view.c +++ b/applications/plugins/subbrute/views/subbrute_main_view.c @@ -33,7 +33,7 @@ void subbrute_main_view_set_callback( instance->context = context; } -void center_displayed_key(FuriString* result, const char* key_cstr, uint8_t index) { +FuriString* center_displayed_key(const char* key_cstr, uint8_t index) { uint8_t str_index = (index * 3); char display_menu[] = { @@ -75,7 +75,7 @@ void center_displayed_key(FuriString* result, const char* key_cstr, uint8_t inde display_menu[15] = ' '; } } - result = furi_string_alloc_set(display_menu); + return furi_string_alloc_set(display_menu); } void subbrute_main_view_draw(Canvas* canvas, SubBruteMainViewModel* model) { @@ -97,9 +97,8 @@ void subbrute_main_view_draw(Canvas* canvas, SubBruteMainViewModel* model) { canvas_draw_str_aligned(canvas, 64, 26, AlignCenter, AlignTop, msg_index); FuriString* menu_items; - menu_items = furi_string_alloc(); - center_displayed_key(menu_items, m->key_field, m->index); + menu_items = center_displayed_key(m->key_field, m->index); canvas_set_font(canvas, FontSecondary); canvas_draw_str_aligned( canvas, 64, 40, AlignCenter, AlignTop, furi_string_get_cstr(menu_items)); @@ -109,6 +108,7 @@ void subbrute_main_view_draw(Canvas* canvas, SubBruteMainViewModel* model) { elements_button_right(canvas, ">"); furi_string_reset(menu_items); + furi_string_free(menu_items); } else { // Menu canvas_set_color(canvas, ColorBlack); diff --git a/applications/plugins/wifi_marauder_companion/scenes/wifi_marauder_scene_console_output.c b/applications/plugins/wifi_marauder_companion/scenes/wifi_marauder_scene_console_output.c index d1c5e8017..c5afa6502 100644 --- a/applications/plugins/wifi_marauder_companion/scenes/wifi_marauder_scene_console_output.c +++ b/applications/plugins/wifi_marauder_companion/scenes/wifi_marauder_scene_console_output.c @@ -35,13 +35,13 @@ void wifi_marauder_scene_console_output_on_enter(void* context) { if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) { const char* help_msg = "For app support/feedback,\nreach out to me:\n@cococode#6011 (discord)\n0xchocolate (github)\n"; - string_cat_str(app->text_box_store, help_msg); + furi_string_cat_str(app->text_box_store, help_msg); app->text_box_store_strlen += strlen(help_msg); } if(app->show_stopscan_tip) { const char* help_msg = "Press BACK to send stopscan\n"; - string_cat_str(app->text_box_store, help_msg); + furi_string_cat_str(app->text_box_store, help_msg); app->text_box_store_strlen += strlen(help_msg); } }