[Live-devel] memory leak with cleaning up AMRAudioRTPSource?

Chenglim Ear chenglim.ear at openwave.com
Wed Aug 25 12:14:11 PDT 2004


AMRAudioRTPSource::createNew() will call RawAMRRTPSource::createNew() to
create an rtp source and AMRDeinterleaver::createNew() to create an audio
source for reading.  If it fails to create the deinterleaver, it will call
Medium::close() to close the rtp source.  If not, it leaves it to the caller
to handle this clean up by returning the pointer to the rtp source in
resultRTPSource (the third parameter).

 

In MediaSession::initiate(), the AMRAudioRTPSource::createNew() method is
called for fCodecName equal to "AMR".  fReadSource is used to point to the
returned audio source (deinterleaver) and fRTPSource is used to point to the
rtp source.

 

When the MediaSubsession is deleted, MediaSubsession::deInitiate() is
called.  In MediaSubsession::deInitiate(), there's a call to
"Medium::close(fReadSource)" and a comment saying that it is assumed to also
close fRTPSource.  This does not appear to be what happens.  As a result
fRTPSource is never closed and you have a memory leak.

 

I have fixed this problem by adding the following line after
"Medium::close(fReadSource)":

 

    if (fRTPSource != fReadSource) Medium::close(fRTPSource);

 

Is this a bug that needs fixing and is this the correct fix?

 

Chenglim.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live.com/pipermail/live-devel/attachments/20040825/c7aac07d/attachment.html


More information about the live-devel mailing list