Fix memleak when not doing passthrough

pull/3530/head
Isaac Connor 2022-07-13 18:41:51 -04:00
parent d0ca677207
commit 576448e906
1 changed files with 4 additions and 2 deletions

View File

@ -227,7 +227,10 @@ void PacketQueue::clearPackets(const std::shared_ptr<ZMPacket> &add_packet) {
while ((*pktQueue.begin() != add_packet) and (packet_counts[video_stream_id] > pre_event_video_packet_count + tail_count)) {
std::shared_ptr<ZMPacket> zm_packet = *pktQueue.begin();
ZMLockedPacket *lp = new ZMLockedPacket(zm_packet);
if (!lp->trylock()) break;
if (!lp->trylock()) {
delete lp;
break;
}
delete lp;
if (is_there_an_iterator_pointing_to_packet(zm_packet)) {
@ -245,7 +248,6 @@ void PacketQueue::clearPackets(const std::shared_ptr<ZMPacket> &add_packet) {
packet_counts[video_stream_id],
pre_event_video_packet_count,
pktQueue.size());
//delete zm_packet;
} // end while
return;
}