diff --git a/srtcore/queue.cpp b/srtcore/queue.cpp index 71981de5e6..b8e3f075c9 100644 --- a/srtcore/queue.cpp +++ b/srtcore/queue.cpp @@ -1162,7 +1162,6 @@ srt::CRcvQueue::~CRcvQueue() while (!i->second.empty()) { CPacket* pkt = i->second.front(); - delete[] pkt->m_pcData; delete pkt; i->second.pop(); } @@ -1365,14 +1364,12 @@ srt::EReadStatus srt::CRcvQueue::worker_RetrieveUnit(int32_t& w_id, CUnit*& w_un { // no space, skip this packet CPacket temp; - temp.m_pcData = new char[m_szPayloadSize]; - temp.setLength(m_szPayloadSize); + temp.allocate(m_szPayloadSize); THREAD_PAUSED(); EReadStatus rst = m_pChannel->recvfrom((w_addr), (temp)); THREAD_RESUMED(); // Note: this will print nothing about the packet details unless heavy logging is on. LOGC(qrlog.Error, log << CONID() << "LOCAL STORAGE DEPLETED. Dropping 1 packet: " << temp.Info()); - delete[] temp.m_pcData; // Be transparent for RST_ERROR, but ignore the correct // data read and fake that the packet was dropped. @@ -1734,7 +1731,6 @@ void srt::CRcvQueue::removeConnector(const SRTSOCKET& id) log << "removeConnector: ... and its packet queue with " << i->second.size() << " packets collected"); while (!i->second.empty()) { - delete[] i->second.front()->m_pcData; delete i->second.front(); i->second.pop(); } @@ -1780,7 +1776,7 @@ void srt::CRcvQueue::storePkt(int32_t id, CPacket* pkt) } else { - // avoid storing too many packets, in case of malfunction or attack + // Avoid storing too many packets, in case of malfunction or attack. if (i->second.size() > 16) { delete pkt; @@ -1793,7 +1789,7 @@ void srt::CRcvQueue::storePkt(int32_t id, CPacket* pkt) void srt::CMultiplexer::destroy() { - // Reverse order of the assigned + // Reverse order of the assigned. delete m_pRcvQueue; delete m_pSndQueue; delete m_pTimer;