This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit e1dfa3d477229d78b38d2f57163e00cb44080753
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Sep 26 04:21:45 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sun Oct 11 00:53:40 2026 +0000

    avfilter/vsrc_life: factor the grid allocation out of both init paths
---
 libavfilter/vsrc_life.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c
index aa1fafe674..1a5a1408d5 100644
--- a/libavfilter/vsrc_life.c
+++ b/libavfilter/vsrc_life.c
@@ -212,6 +212,19 @@ static void fill_picture_rgb(AVFilterContext *ctx, AVFrame 
*picref)
     }
 }
 
+static int alloc_grid(AVFilterContext *ctx)
+{
+    LifeContext *life = ctx->priv;
+
+    if (!(life->buf[0] = av_calloc(life->h * life->w, sizeof(*life->buf[0]))) 
||
+        !(life->buf[1] = av_calloc(life->h * life->w, sizeof(*life->buf[1])))) 
{
+        av_freep(&life->buf[0]);
+        av_freep(&life->buf[1]);
+        return AVERROR(ENOMEM);
+    }
+    return 0;
+}
+
 static int init_pattern_from_file(AVFilterContext *ctx)
 {
     LifeContext *life = ctx->priv;
@@ -247,12 +260,8 @@ static int init_pattern_from_file(AVFilterContext *ctx)
         life->h = h;
     }
 
-    if (!(life->buf[0] = av_calloc(life->h * life->w, sizeof(*life->buf[0]))) 
||
-        !(life->buf[1] = av_calloc(life->h * life->w, sizeof(*life->buf[1])))) 
{
-        av_freep(&life->buf[0]);
-        av_freep(&life->buf[1]);
-        return AVERROR(ENOMEM);
-    }
+    if ((ret = alloc_grid(ctx)) < 0)
+        return ret;
 
     /* fill buf[0] */
     p = life->file_buf;
@@ -289,12 +298,8 @@ static av_cold int init(AVFilterContext *ctx)
         /* fill the grid randomly */
         int i;
 
-        if (!(life->buf[0] = av_calloc(life->h * life->w, 
sizeof(*life->buf[0]))) ||
-            !(life->buf[1] = av_calloc(life->h * life->w, 
sizeof(*life->buf[1])))) {
-            av_freep(&life->buf[0]);
-            av_freep(&life->buf[1]);
-            return AVERROR(ENOMEM);
-        }
+        if ((ret = alloc_grid(ctx)) < 0)
+            return ret;
         if (life->random_seed == -1)
             life->random_seed = av_get_random_seed();
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to