net.c: use after free in coap_free_context()

Because of incorrect free order, if there are open TLS connections when
coap_free_context() is called a use after free will occur as OpenSSL tries to
shutdown the connections.
This commit is contained in:
jcmichelou committed 2018-04-16 20:48:23 +02:00
1 parent f889c29881
commit fa5766f642
1 file changed
+3 -3
+3 -3
View File
@@ -500,13 +500,13 @@ coap_free_context(coap_context_t *context) {
coap_delete_all_resources(context);
if (context->dtls_context)
coap_dtls_free_context(context->dtls_context);
LL_FOREACH_SAFE(context->endpoint, ep, tmp) {
coap_free_endpoint(ep);
}
if (context->dtls_context)
coap_dtls_free_context(context->dtls_context);
if (context->psk_hint)
coap_free(context->psk_hint);