[FFmpeg-devel] [PATCH 2/4] fftools/ffmpeg_filter: fail on ifilter_alloc() failure

Anton Khirnov anton at khirnov.net
Tue Nov 7 14:58:33 EET 2023


---
 fftools/ffmpeg_filter.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index c738fc3397..c8920d9234 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -905,8 +905,14 @@ int fg_create(FilterGraph **pfg, char *graph_desc)
 
     for (AVFilterInOut *cur = inputs; cur; cur = cur->next) {
         InputFilter *const ifilter = ifilter_alloc(fg);
-        InputFilterPriv       *ifp = ifp_from_ifilter(ifilter);
+        InputFilterPriv       *ifp;
 
+        if (!ifilter) {
+            ret = AVERROR(ENOMEM);
+            goto fail;
+        }
+
+        ifp            = ifp_from_ifilter(ifilter);
         ifp->linklabel = cur->name;
         cur->name      = NULL;
 
-- 
2.42.0



More information about the ffmpeg-devel mailing list