aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_decimate.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-10-19 10:12:09 +0200
committerPaul B Mahol <onemda@gmail.com>2019-10-19 10:18:35 +0200
commitc8f3915f8d39dcb20ba79bb955b2d0899f0b0147 (patch)
treed24a889bebe5788a01f7690e0d745544c5f678d7 /libavfilter/vf_decimate.c
parent723d69f99cd26db9687ed2d24d06afaff624daf3 (diff)
downloadffmpeg-c8f3915f8d39dcb20ba79bb955b2d0899f0b0147.tar.gz
avfilter/vf_decimate: fix memory leaks
Fixes #8311
Diffstat (limited to 'libavfilter/vf_decimate.c')
-rw-r--r--libavfilter/vf_decimate.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c
index 53347c7f10..88a8b38a58 100644
--- a/libavfilter/vf_decimate.c
+++ b/libavfilter/vf_decimate.c
@@ -217,11 +217,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
av_frame_free(&dm->queue[i].frame);
} else {
AVFrame *frame = dm->queue[i].frame;
+ dm->queue[i].frame = NULL;
if (frame->pts != AV_NOPTS_VALUE && dm->start_pts == AV_NOPTS_VALUE)
dm->start_pts = frame->pts;
if (dm->ppsrc) {
av_frame_free(&frame);
frame = dm->clean_src[i];
+ dm->clean_src[i] = NULL;
}
frame->pts = av_rescale_q(outlink->frame_count_in, dm->ts_unit, (AVRational){1,1}) +
(dm->start_pts == AV_NOPTS_VALUE ? 0 : dm->start_pts);
@@ -314,7 +316,15 @@ static av_cold void decimate_uninit(AVFilterContext *ctx)
av_frame_free(&dm->last);
av_freep(&dm->bdiffs);
+ if (dm->queue) {
+ for (i = 0; i < dm->cycle; i++)
+ av_frame_free(&dm->queue[i].frame);
+ }
av_freep(&dm->queue);
+ if (dm->clean_src) {
+ for (i = 0; i < dm->cycle; i++)
+ av_frame_free(&dm->clean_src[i]);
+ }
av_freep(&dm->clean_src);
for (i = 0; i < ctx->nb_inputs; i++)
av_freep(&ctx->input_pads[i].name);