[Live-devel] Possible memory leak in MIKEYPayload

Micha Kalfon micha at tokagroup.com
Wed Jan 13 06:23:23 PST 2021


I suspect there's a memory leak in the MIKEYPayload class. The fData member
is initialized with dynamic allocation in the constructor:

MIKEYPayload::MIKEYPayload(MIKEYState& ourMIKEYState, u_int8_t payloadType,
                           u_int8_t const* data, unsigned dataSize)
  : fOurMIKEYState(ourMIKEYState), fPayloadType(payloadType),
    fDataSize(dataSize), fNext(NULL) {

*  fData = new u_int8_t[fDataSize];*  memcpy(fData, data, fDataSize);
}

However, the destructor does not free it:

MIKEYPayload::~MIKEYPayload() {
  delete fNext;
}

This leak was detected by valgrind memleak.


--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20210113/e654bf00/attachment.htm>


More information about the live-devel mailing list