diff mbox series

[FFmpeg-devel,6/7] avcodec/iff: Remove transient objects from the context

Message ID DB6PR0101MB2214F511410974765C4175C38F869@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Accepted
Commit 487fc61cb22f7ed07626577044eda7bd2deb2366
Headers show
Series [FFmpeg-devel,1/7] avcodec/iff: Split extract_header into extradata and packet part | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt July 12, 2022, 10:27 a.m. UTC
This avoids keeping invalid pointers in the context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/iff.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 00d0105be3..ad96bd9191 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -45,7 +45,6 @@  typedef enum {
 } mask_type;
 
 typedef struct IffContext {
-    AVFrame *frame;
     int planesize;
     uint8_t * planebuf;
     uint8_t * ham_buf;      ///< temporary buffer for planar to chunky conversation
@@ -63,7 +62,6 @@  typedef struct IffContext {
     unsigned  masking;      ///< TODO: masking method used
     int init; // 1 if buffer and palette data already initialized, 0 otherwise
     int16_t   tvdc[16];     ///< TVDC lookup table
-    GetByteContext gb;
     uint8_t *video[2];
     unsigned video_size;
     uint32_t *pal;
@@ -1529,7 +1527,7 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
     int buf_size           = avpkt->size;
     const uint8_t *buf_end = buf + buf_size;
     int y, plane, res;
-    GetByteContext *gb = &s->gb;
+    GetByteContext gb0, *const gb = &gb0;
     const AVPixFmtDescriptor *desc;
 
     bytestream2_init(gb, avpkt->data, avpkt->size);
@@ -1539,7 +1537,6 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
 
     if ((res = ff_get_buffer(avctx, frame, 0)) < 0)
         return res;
-    s->frame = frame;
 
     buf      += bytestream2_tell(gb);
     buf_size -= bytestream2_tell(gb);
@@ -1558,7 +1555,7 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
 
     if (s->compression <= 0xff && (avctx->codec_tag == MKTAG('A', 'N', 'I', 'M'))) {
         if (avctx->pix_fmt == AV_PIX_FMT_PAL8)
-            memcpy(s->pal, s->frame->data[1], 256 * 4);
+            memcpy(s->pal, frame->data[1], 256 * 4);
     }
 
     switch (s->compression) {