Skip to content

Commit

Permalink
Fix several memory leaks in services/dvr.cpp. Coverity defects 700670…
Browse files Browse the repository at this point in the history
…, 700671, 700672 & 700673
  • Loading branch information
stuartm committed May 24, 2012
1 parent 9f7cb75 commit b30825e
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions mythtv/programs/mythbackend/services/dvr.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -598,6 +598,7 @@ DTC::RecRule* Dvr::GetRecordSchedule( uint nRecordId )

DTC::RecRule *pRecRule = new DTC::RecRule();
FillRecRuleInfo( pRecRule, pRule );
delete pRule;

return pRecRule;
}
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit b30825e

Please sign in to comment.