Memory leak in transport session

Hi, all
It seems that the mutex is still not destroyed when the transport session is freed in janus_transport_session_free().

Would you please be more specific?

Each transport session has its own mutex.
Mutex is initialized in janus_transport_session_create():
janus_mutex_init(&tp->mutex);
and should be destroyed in janus_transport_session_free() like
janus_mutex_destroy(&session->mutex) before g_free(session);

TL;DR: we should fix that, but for most implementations / architectures the mutex clear is a no-op.

Calls to janus_mutex_destroy are basically missing everywhere in the current code.
This has already been discussed, see here: [1.x] Resource leak in janus_recorder_free? · Issue #3128 · meetecho/janus-gateway · GitHub

Thank you for explanation.
I’ve been working with this fix for 2 years on CentOS 6/7.
Before the fix, there was a 4-byte memory leak after every session close on [0.x] version.

I’ve prepared a more generic and comprehensive PR that tries to add a destroy for every mutex init we have: Cleanup of initialized mutexes by lminiero · Pull Request #3547 · meetecho/janus-gateway · GitHub

It should be pointed out that on Linux this shouldn’t really be needed, as from what I could read, even when using pthreads instead of GLib’s futex, no allocation is performed. But from a semantic perspective, it’s indeed good practice to have a destroy for every init, hence the patch.