From 7bb15899a8db92fec99928a1e1622936ff85005a Mon Sep 17 00:00:00 2001
From: Vasyl Gello <vasek.gello@gmail.com>
Date: Sat, 15 Oct 2022 16:09:20 +0000
Subject: [PATCH 2/3] Fix use-after-free in TimeshiftSegment

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
---
 src/stream/TimeshiftSegment.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/stream/TimeshiftSegment.cpp b/src/stream/TimeshiftSegment.cpp
index 9323a44..9e1cd09 100644
--- a/src/stream/TimeshiftSegment.cpp
+++ b/src/stream/TimeshiftSegment.cpp
@@ -90,8 +90,8 @@ void TimeshiftSegment::AddPacket(DEMUX_PACKET* packet)
   m_packetBuffer.emplace_back(newPacket);
 
   int secondsSinceStart = 0;
-  if (packet->pts != STREAM_NOPTS_VALUE && packet->pts > 0)
-    secondsSinceStart = packet->pts / STREAM_TIME_BASE;
+  if (newPacket->pts != STREAM_NOPTS_VALUE && newPacket->pts > 0)
+    secondsSinceStart = newPacket->pts / STREAM_TIME_BASE;
 
   if (secondsSinceStart != m_lastPacketSecondsSinceStart)
   {
-- 
2.35.1

