mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Fixed VideoCapture memory leak (bug #1481)
This commit is contained in:
parent
95e657714f
commit
689c1814a5
@ -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
|
||||
|
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user