[Live-devel] Memory Leak Occurs.

변규석 gsbyun at lgcns.com
Sun Feb 25 17:24:49 PST 2018


1. Case Description.
 Leaks occur when requesting the same rtsp token at the same time.
(The same rtsp token means the same url.)


2. Modification code.
original code.
void OnDemandServerMediaSubsession
::setSDPLinesFromRTPSink(RTPSink* rtpSink, FramedSource* inputSource,
unsigned estBitrate) {
..............

  fSDPLines = strDup(sdpLines);
  delete[] sdpLines;
}




leak prevention code.
void OnDemandServerMediaSubsession
::setSDPLinesFromRTPSink(RTPSink* rtpSink, FramedSource* inputSource,
unsigned estBitrate) {
..............
  if (fSDPLines!=NULL) {
    if(strcmp(fSDPLines,sdpLines)==0) 
    {
      printf("exisiting sdp line\n"); 
      goto FSDPLINES_OUT;
    }
    else
    {
      printf("not null fSDPLines, but sdpLine replacement is
required.\n"); 
      delete[] fSDPLines;  
    }
  }
  fSDPLines = strDup(sdpLines);
FSDPLINES_OUT:
  delete[] sdpLines;
}

 

3. Valgrind Log
 141 ==00:01:07:51.522 10123== 1,182 bytes in 6 blocks are definitely
lost in loss record 1 of 1
 142 ==00:01:07:51.522 10123==    at 0x4C2A8A8: operator new[](unsigned
long) (vg_replace_malloc.c:423)
 143 ==00:01:07:51.522 10123==    by 0x525CAEF: strDup(char const*)
(strDup.cpp:26)
 144 ==00:01:07:51.522 10123==    by 0x5518F34:
OnDemandServerMediaSubsession::setSDPLinesFromRTPSink(RTPSink*,
FramedSource*, unsigned int) (OnDemandServerMediaSubsession.cpp:468)
 145 ==00:01:07:51.522 10123==    by 0x5519054:
OnDemandServerMediaSubsession::sdpLines()
(OnDemandServerMediaSubsession.cpp:76)
 146 ==00:01:07:51.522 10123==    by 0x5517419:
ServerMediaSession::generateSDPDescription()
(ServerMediaSession.cpp:240)
 147 ==00:01:07:51.522 10123==    by 0x550611D:
RTSPServer::RTSPClientConnection::handleCmd_DESCRIBE(char const*, char
const*, char const*) (RTSPServer.cpp:345)
 148 ==00:01:07:51.522 10123==    by 0x5505280:
RTSPServer::RTSPClientConnection::handleRequestBytes(int)
(RTSPServer.cpp:750)
 149 ==00:01:07:51.522 10123==    by 0x550357A:
GenericMediaServer::ClientConnection::incomingRequestHandler()
(GenericMediaServer.cpp:254)
 150 ==00:01:07:51.522 10123==    by 0x505679B:
BasicTaskScheduler::SingleStep(unsigned int)
(BasicTaskScheduler.cpp:171)
 151 ==00:01:07:51.522 10123==    by 0x505577B:
BasicTaskScheduler0::doEventLoop(char volatile*)
(BasicTaskScheduler0.cpp:80)
 152 ==00:01:07:51.522 10123==    by 0x404FAE:
CustomVideoServerMediaSubsession::getAuxSDPLine(RTPSink*,
FramedSource*) (CustomVideoServerMediaSubsession.cpp:74)
 153 ==00:01:07:51.522 10123==    by 0x5518E25:
OnDemandServerMediaSubsession::setSDPLinesFromRTPSink(RTPSink*,
FramedSource*, unsigned int) (OnDemandServerMediaSubsession.cpp:433)


  _____  

상기 메시지와 첨부화일 내에는 비밀정보가 포함되어 있을 수 있으며, 지정된 수신자에 한하여 조회 및 사용될 수 있습니다. 만약
송신자의 실수로 인하여 상기 메시지를 수신하였다면, 송신자에게 메시지를 반송해 주시고, 원본 메시지와 모든 사본을 폐기해 주시기
바랍니다.
상기 메시지의 전체 또는 일부에 대해 무단 열람, 사용, 공개, 배포하는 것은 금지되어 있습니다.(주)LG CNS.
This message and its attachments may contain confidential information,
and they are intended to be viewed or used by only the individuals
specified in the message. If you have received this message in an error
from the sender, please contact the sender immediately to notify the
error and delete all of the message and its copies. It is prohibited to
view, use, make public and/or distribute part or whole of this message
without written permission.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20180226/832c025a/attachment.html>


More information about the live-devel mailing list