Fixed VideoCapture memory leak (bug #1481)

This commit is contained in:
Alexander Reshetnikov 2012-04-27 19:23:26 +00:00
parent 95e657714f
commit 689c1814a5
2 changed files with 12 additions and 0 deletions

View File

@ -468,6 +468,12 @@ bool CvCapture_FFMPEG::grabFrame()
picture_pts = packet.pts;
valid = 1;
}
if (packet.data)
{
av_free_packet(&packet);
packet.data = NULL;
}
}
// return if we have a new picture or not

View File

@ -463,6 +463,12 @@ bool CvCapture_FFMPEG::grabFrame()
if (count_errs > max_number_of_attempts)
break;
}
if (packet.data)
{
av_free_packet (&packet);
packet.data = NULL;
}
}
if( valid && first_frame_number < 0 )