[asterisk-dev] Resource leak in SIP/TCP

Steve Davies davies147 at gmail.com
Fri Jan 13 12:21:01 CST 2012


Hi,

I am pretty sure of the following, but am not a pthread expert... The
code is the same in 1.6.2 and 1.8.8.1, I've not checked version 10
yet.

There is a thread resource leak in SIP-over-TCP or TLS. If a TCP
connection fails, then the thread is torn down, but as the thread is
created 'joinable' in sip_prepare_socket(), and nothing ever
pthread_join()'s to it, we leak about 240Kb and 2x mmap maps.

Question - Should the thread be created detached? Or should the thread
be pthread_join()'ed in sip_tcptls_client_args_destructor(), as the
object being destroyed seems to hold a reference to the thread.

I have not checked whether sip_tcptls_client_args_destructor runs in
the thread or outside it, which may answer the question.

Thanks,
Steve



More information about the asterisk-dev mailing list