[Live-devel] Memory leaks in RTPInterface

Chris Richardson (WTI) chris at gotowti.com
Tue Jul 2 17:25:24 PDT 2013


Hi Ross,

 

In testing the most recent version (2013.06.30), I noticed a couple memory
leaks.  I know your stance on memory leaks, but these two occur during
normal play/stop operation (not just at shutdown), and so they will have
noticeable effect on long-running devices.

 

In the SocketDescriptor destructor, the HashTable::Iterator* "iter" is never
deleted.

 

In SocketDescriptor::deregisterRTPInterface, the fDeleteMyselfNext member is
set to "true", but (for me at least), the tcpReadHandler function is never
called again, and so the SocketDescriptor deletion never happens.  I believe
this was changed from "delete this;" in version 2013.04.29 or 2013.04.30 to
avoid crashing if the tcpReadHandler is about to execute just after the
socket descriptor is deleted.

 

A fix that works here and does not result in a memory leak is to change the
fDeleteMyselfNext back to "delete this;", but also change
RTPInterface::stopNetworkReading and RTPInterface::removeStreamSocket to set
fReadHandlerProc to NULL before calling deregisterSocket.  This way the read
handler on the about-to-be-deleted RTPInterface is not called in case
tcpReadHandler is about to execute.

 

I have attached a patch that fixes both issues for me, but I am definitely
not an expert on the inner-workings of RTPInterface.  If anybody who was
experiencing the prior crashes would test this I would be grateful.

 

Thanks,


Chris Richardson

WTI

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130702/ff138898/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RTPInterface.cpp.patch
Type: application/octet-stream
Size: 1412 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130702/ff138898/attachment.obj>


More information about the live-devel mailing list