Skip to content

Conversation

@h2zero
Copy link
Owner

@h2zero h2zero commented Jan 12, 2025

If clear results is called from more than one task a race condition exists that may delete the same advertisedDevice twice. This prevents this by swapping with an empty vector and testing for empty before freeing the resources.

If clear results is called from more than one task a race condition exists that may delete the same advertisedDevice twice.
This prevents this by swapping with an empty vector and testing for empty before freeing the resources.
@h2zero h2zero force-pushed the bugfix/scan-clearResults-crash branch from 390ee45 to 81a863d Compare January 13, 2025 00:20
@h2zero h2zero merged commit e624962 into master Jan 13, 2025
59 checks passed
@h2zero h2zero deleted the bugfix/scan-clearResults-crash branch January 13, 2025 01:12
@thekurtovic
Copy link
Collaborator

Does this apply to other areas in the codebase which have a similar clear/delete method?
https://github.com/h2zero/esp-nimble-cpp/blob/master/src/NimBLEClient.cpp#L102-L109

@h2zero
Copy link
Owner Author

h2zero commented Jan 13, 2025

Shouldn't be an issue here unless deleting the client instance from multiple tasks, which would be quite odd.

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.

3 participants