Skip to content
Browse files

Fix several memory leaks in services/dvr.cpp. Coverity defects 700670…

…, 700671, 700672 & 700673
  • Loading branch information...
1 parent 9f7cb75 commit b30825e3119992be374ca6bf5e720199e710650c @stuartm stuartm committed May 24, 2012
Showing with 16 additions and 15 deletions.
  1. +16 −15 mythtv/programs/mythbackend/services/dvr.cpp
View
31 mythtv/programs/mythbackend/services/dvr.cpp
@@ -537,10 +537,10 @@ bool Dvr::RemoveRecordSchedule ( uint nRecordId )
if (nRecordId <= 0 )
throw( QString("Record ID appears invalid."));
- RecordingRule *pRule = new RecordingRule();
- pRule->m_recordID = nRecordId;
+ RecordingRule pRule;
+ pRule.m_recordID = nRecordId;
- bResult = pRule->Delete();
+ bResult = pRule.Delete();
return bResult;
}
@@ -598,6 +598,7 @@ DTC::RecRule* Dvr::GetRecordSchedule( uint nRecordId )
DTC::RecRule *pRecRule = new DTC::RecRule();
FillRecRuleInfo( pRecRule, pRule );
+ delete pRule;
return pRecRule;
}
@@ -609,14 +610,14 @@ bool Dvr::EnableRecordSchedule ( uint nRecordId )
if (nRecordId <= 0 )
throw( QString("Record ID appears invalid."));
- RecordingRule *pRule = new RecordingRule();
- pRule->m_recordID = nRecordId;
- pRule->Load();
+ RecordingRule pRule;
+ pRule.m_recordID = nRecordId;
+ pRule.Load();
- if (pRule->IsLoaded())
+ if (pRule.IsLoaded())
{
- pRule->m_isInactive = false;
- pRule->Save();
+ pRule.m_isInactive = false;
+ pRule.Save();
bResult = true;
}
@@ -630,14 +631,14 @@ bool Dvr::DisableRecordSchedule( uint nRecordId )
if (nRecordId <= 0 )
throw( QString("Record ID appears invalid."));
- RecordingRule *pRule = new RecordingRule();
- pRule->m_recordID = nRecordId;
- pRule->Load();
+ RecordingRule pRule;
+ pRule.m_recordID = nRecordId;
+ pRule.Load();
- if (pRule->IsLoaded())
+ if (pRule.IsLoaded())
{
- pRule->m_isInactive = true;
- pRule->Save();
+ pRule.m_isInactive = true;
+ pRule.Save();
bResult = true;
}

0 comments on commit b30825e

Please sign in to comment.
Something went wrong with that request. Please try again.