From db17a4ee6fb328cdae82cdacb21ad1bbd61984b1 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Sep 2012 19:13:49 +0400 Subject: [PATCH] driver/record.cpp: fix fd leak, if record start failed --- src/driver/record.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index a5ff08e7c..50de25279 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -171,10 +171,10 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) record->Open(); if(!record->Start(fd, (unsigned short ) allpids.PIDs.vpid, (unsigned short *) apids, numpids, channel_id)) { - /* Stop do close fd */ record->Stop(); delete record; record = NULL; + close(fd); unlink(tsfile.c_str()); hintBox.hide(); return RECORD_FAILURE; @@ -215,6 +215,7 @@ bool CRecordInstance::Stop(bool remove_event) printf("%s: channel %llx recording_id %d\n", __FUNCTION__, channel_id, recording_id); SaveXml(); + /* Stop do close fd - if started */ record->Stop(); if(!autoshift)