[Live-devel] MORE: Memory leaks in DarwinInjector.cpp

eyal.b at mavix.com eyal.b at mavix.com
Fri Nov 16 03:42:53 PST 2007


Hello,

      In my previous mail I have suggested how to prevent memory leaks in
DarwinInjector.

I want to correct a possible crash in my solution and add some more.

 

1) My solution could cause NULL pointer memory access error when a
DarwinInjector was deleted before a session was created. So a "if (session)"
clause was added before my use of "session" in DarwinInjector's destructor.

 

2) I have added a deletion of MediaSubsession's sessionId in the
MediaSubsession destructor. This way it is safe to delete a session without
causing a memory leak because of sessionId.

 

MediaSubsession::~MediaSubsession() {

...

  delete[] sessionId;//allocated by RTSP, freed only by RTSP Tear-Session

...

}

 

3) When using a couple of DarwinInjector instances/sessions, the first
stream of each does not get to have a track-id of "1", but the value is
being kept incremented. This is because the track-id used is a static
variable in the injector module.

   I had changed the variable to be a member of the injector, to be init as
0 in the constructor, and be passes by reference to be incremented by
SubstreamDescriptor in DarwinInjector::addStream().

 

Attached in DarwinInjector cpp and h files, with my previous and last
modifications, marked with "/**/" on each modified line's start.

 

Eyal Beit-Halachmi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20071116/598f6f16/attachment-0001.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: DarwinInjector.cpp
Url: http://lists.live555.com/pipermail/live-devel/attachments/20071116/598f6f16/attachment-0001.ksh 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DarwinInjector.hh
Type: application/octet-stream
Size: 3496 bytes
Desc: not available
Url : http://lists.live555.com/pipermail/live-devel/attachments/20071116/598f6f16/attachment-0001.obj 


More information about the live-devel mailing list