[FFmpeg-devel] [PATCH] avfilter/vsrc_mandelbrot: Check for malloc failure

Michael Niedermayer michael at niedermayer.cc
Thu Apr 21 23:45:12 EEST 2022


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavfilter/vsrc_mandelbrot.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 20f62ed42e..d4d7e2fa49 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -134,6 +134,9 @@ static av_cold int init(AVFilterContext *ctx)
     s-> next_cache= av_malloc_array(s->cache_allocated, sizeof(*s-> next_cache));
     s-> zyklus    = av_malloc_array(s->maxiter + 16, sizeof(*s->zyklus));
 
+    if (!s->point_cache || !s->next_cache || !s->zyklus)
+        return AVERROR(ENOMEM);
+
     return 0;
 }
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list