Skip to content
Permalink
Browse files

Fix a memory leak in mythcommflag

ClassicCommDetector::ProcessFrame leaked vast amounts of memory if the
blank-frame method is not enabled.
  • Loading branch information
John Patrick Poet
John Patrick Poet committed May 26, 2011
1 parent fb5912d commit f442cff20d74af4b95fa5bad40a12afa771c353e
Showing with 8 additions and 0 deletions.
  1. +8 −0 mythtv/programs/mythcommflag/ClassicCommDetector.cpp
@@ -753,13 +753,17 @@ void ClassicCommDetector::ProcessFrame(VideoFrame *frame,
{
VERBOSE(VB_COMMFLAG, "CommDetect: Invalid video frame or codec, "
"unable to process frame.");
delete[] rowMax;
delete[] colMax;
return;
}

if (!width || !height)
{
VERBOSE(VB_COMMFLAG, "CommDetect: Width or Height is 0, "
"unable to process frame.");
delete[] rowMax;
delete[] colMax;
return;
}

@@ -863,6 +867,7 @@ void ClassicCommDetector::ProcessFrame(VideoFrame *frame,
bottomDarkRow = y;

delete[] rowMax;
rowMax = 0;

for(int x = commDetectBorder; x < (width - commDetectBorder);
x += horizSpacing)
@@ -879,6 +884,7 @@ void ClassicCommDetector::ProcessFrame(VideoFrame *frame,
rightDarkCol = x;

delete[] colMax;
colMax = 0;

if ((topDarkRow > commDetectBorder) &&
(topDarkRow < (height * .20)) &&
@@ -976,6 +982,8 @@ void ClassicCommDetector::ProcessFrame(VideoFrame *frame,
#endif

framesProcessed++;
delete[] rowMax;
delete[] colMax;
}

void ClassicCommDetector::ClearAllMaps(void)

0 comments on commit f442cff

Please sign in to comment.
You can’t perform that action at this time.