Skip to content

Conversation

@roma-jam
Copy link
Contributor

@roma-jam roma-jam commented Dec 19, 2024

Description

Common sequence for tinyusb CDC driver install:

  1. tinyusb_driver_install()
  2. tusb_cdc_acm_initialized()
  3. tusb_cdc_acm_init()

During the tusb_cdc_acm_init() the internal object cdc_inst->subclass_obj is allocated.
And doesn't freeing during the common uninstall:

  1. tusb_cdc_acm_deinit()
  2. tinyusb_driver_uninstall()

Changes

  • Implemented new static function: obj_free(itf), which is the freeing mechanism for function alloc_obj(itf)
  • Added the obj_free(itf) call while tusb_cdc_acm_deinit()

And during these steps there is no freeing present.

Related

Testing


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@roma-jam roma-jam marked this pull request as ready for review December 19, 2024 22:40
@roma-jam roma-jam self-assigned this Dec 19, 2024
@roma-jam roma-jam added this to the esp_tinyusb v1.6.0 milestone Dec 19, 2024
Copy link
Collaborator

@peter-marcisovsky peter-marcisovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! LGTM

@roma-jam roma-jam force-pushed the fix/cdc_mem_leakage branch from aea49d8 to cda86e8 Compare December 20, 2024 09:08
@roma-jam
Copy link
Contributor Author

Added changes description in CHANGELOG.md

@roma-jam roma-jam merged commit 113058d into master Dec 20, 2024
31 checks passed
@roma-jam roma-jam deleted the fix/cdc_mem_leakage branch December 20, 2024 10:59
@roma-jam roma-jam mentioned this pull request Jan 3, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants