Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not destroy mutexes in coap_cleanup() #1226

Closed
wants to merge 1 commit into from

Conversation

hasheddan
Copy link
Contributor

If mutexes are destroyed in coap_cleanup() they can never be re-initialized as calling coap_startup() short-circuits after its first invocation. This updates to not destroy the mutexes on calls to coap_cleanup().

Fixes #1225

If mutexes are destroyed in coap_cleanup() they can never be
re-initialized as calling coap_startup() short-circuits after its first
invocation. This updates to not destroy the mutexes on calls to
coap_cleanup().

Signed-off-by: Daniel Mangum <[email protected]>
@mrdeep1
Copy link
Collaborator

mrdeep1 commented Sep 8, 2023

coap_cleanup() also destroys things like the DTLS environment as well as Windows / Contiki environment setup, so currently it is unsafe to assume libcoap is stable in any form after calling coap_cleanup(). See coap_cleanup(3).

If the mutexes allocate any memory in coap_startup(), then there will be a memory leak if they are not cleared down in coap_cleanup().

The issue you are finding here needs to be solved in another way. See some of my suggestions in #1225.

@hasheddan hasheddan closed this Sep 8, 2023
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.

Do not destroy mutexes in coap_cleanup()
2 participants