tspacket_fake should be deleted whenever the function
From: Erik Hovland <erik@hovland.org>
returns.
---
libs/libmythtv/mpegrecorder.cpp | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/libs/libmythtv/mpegrecorder.cpp b/libs/libmythtv/mpegrecorder.cpp
index 50d2045..224d554 100644
|
a
|
b
|
|
| 15 | 15 | #include <sys/ioctl.h> |
| 16 | 16 | #include <sys/time.h> |
| 17 | 17 | |
| | 18 | // C++ headers |
| 18 | 19 | #include <algorithm> |
| | 20 | #include <memory> |
| 19 | 21 | using namespace std; |
| 20 | 22 | |
| 21 | 23 | // avlib headers |
| … |
… |
bool MpegRecorder::ProcessTSPacket(const TSPacket &tspacket_real) |
| 1034 | 1036 | { |
| 1035 | 1037 | const uint pid = tspacket_real.PID(); |
| 1036 | 1038 | |
| 1037 | | TSPacket *tspacket_fake = NULL; |
| | 1039 | auto_ptr<TSPacket> tspacket_fake(NULL); |
| 1038 | 1040 | if ((driver == "hdpvr") && (pid == 0x1001)) // PCRPID for HD-PVR |
| 1039 | 1041 | { |
| 1040 | | tspacket_fake = tspacket_real.CreateClone(); |
| | 1042 | tspacket_fake.reset(tspacket_real.CreateClone()); |
| 1041 | 1043 | uint cc = (_continuity_counter[pid] == 0xFF) ? |
| 1042 | 1044 | 0 : (_continuity_counter[pid] + 1) & 0xf; |
| 1043 | 1045 | tspacket_fake->SetContinuityCounter(cc); |
| 1044 | 1046 | } |
| 1045 | 1047 | |
| 1046 | | const TSPacket *tspacket = (tspacket_fake) ? |
| 1047 | | tspacket_fake : &tspacket_real; |
| | 1048 | const TSPacket *tspacket = (tspacket_fake.get()) ? |
| | 1049 | tspacket_fake.get() : &tspacket_real; |
| 1048 | 1050 | |
| 1049 | 1051 | // Check continuity counter |
| 1050 | 1052 | if ((pid != 0x1fff) && !CheckCC(pid, tspacket->ContinuityCounter())) |
| … |
… |
bool MpegRecorder::ProcessTSPacket(const TSPacket &tspacket_real) |
| 1063 | 1065 | |
| 1064 | 1066 | BufferedWrite(*tspacket); |
| 1065 | 1067 | |
| 1066 | | if (tspacket_fake) |
| 1067 | | delete tspacket_fake; |
| 1068 | | |
| 1069 | 1068 | return true; |
| 1070 | 1069 | } |
| 1071 | 1070 | |