Commit b5ebb0d7a6 for ffmpeg

commit b5ebb0d7a6da48cfa7d6eaef3fe27b2a8be144fd
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Tue Nov 3 01:14:50 2026 +0100

    avcodec/gif: return the error of gif_image_write_image()

    A failed allocation of the remap buffer was ignored and a packet
    holding only the header returned.

    Found during the review of the fix for 8onJqhybXBbq.

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index 49dd64a2c5..e5a94426ab 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -501,8 +501,10 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         }
     }

-    gif_image_write_image(avctx, &outbuf_ptr, end, palette,
-                          pict->data[0], pict->linesize[0], pkt);
+    ret = gif_image_write_image(avctx, &outbuf_ptr, end, palette,
+                                pict->data[0], pict->linesize[0], pkt);
+    if (ret < 0)
+        return ret;
     if (!s->last_frame && !s->image) {
         s->last_frame = av_frame_alloc();
         if (!s->last_frame)