Description
I'm using libnyoci in a library for Lua (to make coap available in Lua). When a lot of requests are made with DTLS activated, memory is getting lost.
It looks like somehow the tls data is not cleaned up. The data is received using the same loop that is in the cmd_get code of nyocictl:
while (ERRORCODE_INPROGRESS == gRet) {
if (nyoci) {
nyoci_plat_wait(nyoci, 1000);
nyoci_plat_process(nyoci);
}
}
After all response data from the GET request is received, I do call SSL_CTX_free
on the SSL context and eventually nyoci_release
. This however does not seem to cause the internal TLS functions SSL_shutdown
or SSL_free
to be called.
I reproduced this with nyocictl. A valgrind trace with a GET request shows that the memory allocated using SSL_new and BIO_new in openssl/nyoci-plat-tls.c are never free'd.
How can I make sure that all resources related to a specific DTLS ssl session are released after use?