diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-10-17 11:28:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-05-04 19:35:02 +0200 |
commit | 5b4100cbaedfea847a10c689c0dc75313972c350 (patch) | |
tree | a683c3becd6d1cf3520cecfd8bdf2b8a4ebaa695 | |
parent | 7004a214d02d54ae969aa8d6f5788f728813079d (diff) | |
download | ffmpeg-5b4100cbaedfea847a10c689c0dc75313972c350.tar.gz |
avfilter/vf_random: fix memory leaks
Fixes #8296
(cherry picked from commit 3488e0977c671568731afa12b811adce9d4d807f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavfilter/vf_random.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavfilter/vf_random.c b/libavfilter/vf_random.c index 373a7db053..c7c9ff09c0 100644 --- a/libavfilter/vf_random.c +++ b/libavfilter/vf_random.c @@ -108,6 +108,14 @@ static int request_frame(AVFilterLink *outlink) return ret; } +static av_cold void uninit(AVFilterContext *ctx) +{ + RandomContext *s = ctx->priv; + + for (int i = 0; i < s->nb_frames; i++) + av_frame_free(&s->frames[i]); +} + static const AVFilterPad random_inputs[] = { { .name = "default", @@ -132,6 +140,7 @@ AVFilter ff_vf_random = { .priv_size = sizeof(RandomContext), .priv_class = &random_class, .init = init, + .uninit = uninit, .inputs = random_inputs, .outputs = random_outputs, }; |