[FFmpeg-cvslog] avfilter/vf_separatefields: stop leaking last frame

Paul B Mahol git at videolan.org
Tue Aug 8 19:55:11 EEST 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Aug  8 18:45:32 2017 +0200| [41096904d03611de8024a8dbebb6935d643c3d6b] | committer: Paul B Mahol

avfilter/vf_separatefields: stop leaking last frame

This can happen when filtering is ended without receiving EOF.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41096904d03611de8024a8dbebb6935d643c3d6b
---

 libavfilter/vf_separatefields.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavfilter/vf_separatefields.c b/libavfilter/vf_separatefields.c
index 69653c991f..3ed222f271 100644
--- a/libavfilter/vf_separatefields.c
+++ b/libavfilter/vf_separatefields.c
@@ -118,6 +118,13 @@ static int request_frame(AVFilterLink *outlink)
     return ret;
 }
 
+static av_cold void uninit(AVFilterContext *ctx)
+{
+    SeparateFieldsContext *s = ctx->priv;
+
+    av_frame_free(&s->second);
+}
+
 static const AVFilterPad separatefields_inputs[] = {
     {
         .name         = "default",
@@ -141,6 +148,7 @@ AVFilter ff_vf_separatefields = {
     .name        = "separatefields",
     .description = NULL_IF_CONFIG_SMALL("Split input video frames into fields."),
     .priv_size   = sizeof(SeparateFieldsContext),
+    .uninit      = uninit,
     .inputs      = separatefields_inputs,
     .outputs     = separatefields_outputs,
 };



More information about the ffmpeg-cvslog mailing list