delete packet_lock if failed trylock

This commit is contained in:
Isaac Connor 2021-03-30 16:14:38 -04:00
parent 649f7906de
commit a1364a2b2b
1 changed files with 6 additions and 5 deletions

View File

@ -98,7 +98,7 @@ bool PacketQueue::queuePacket(ZMPacket* add_packet) {
ZMLockedPacket *lp = new ZMLockedPacket(zm_packet);
if (!lp->trylock()) {
Debug(1, "Found locked packet when trying to free up video packets. Can't continue");
//delete lp;
delete lp;
break;
}
delete lp;
@ -543,6 +543,7 @@ ZMLockedPacket *PacketQueue::get_packet(packetqueue_iterator *it) {
Error("Null p?!");
return nullptr;
}
ZMLockedPacket *lp = new ZMLockedPacket(p);
Debug(3, "get_packet %p image_index: %d, about to lock packet", p, p->image_index);
while (!(zm_terminate or deleting) and !lp->trylock()) {