diff --git a/srtcore/packet.cpp b/srtcore/packet.cpp index 3bf11e49b9..3a17c44bcc 100644 --- a/srtcore/packet.cpp +++ b/srtcore/packet.cpp @@ -221,6 +221,7 @@ void CPacket::deallocate() if (m_data_owned) delete[](char*) m_PacketVector[PV_DATA].data(); m_PacketVector[PV_DATA].set(NULL, 0); + m_data_owned = false; } char* CPacket::release() @@ -241,8 +242,7 @@ CPacket::~CPacket() { // PV_HEADER is always owned, PV_DATA may use a "borrowed" buffer. // Delete the internal buffer only if it was declared as owned. - if (m_data_owned) - delete[](char*) m_PacketVector[PV_DATA].data(); + deallocate(); } size_t CPacket::getLength() const