[FFmpeg-cvslog] avcodec/m[jx]pegdec: Simplify freeing frame

Andreas Rheinhardt git at videolan.org
Wed Apr 9 15:03:21 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Apr  2 18:32:10 2025 +0200| [1267273663a52a13b93b784870b854ec75512f9f] | committer: Andreas Rheinhardt

avcodec/m[jx]pegdec: Simplify freeing frame

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1267273663a52a13b93b784870b854ec75512f9f
---

 libavcodec/mjpegdec.c | 7 ++-----
 libavcodec/mxpegdec.c | 2 --
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index f3d940671e..a2dca7a88a 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2954,11 +2954,8 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_INFO, "Single field\n");
     }
 
-    if (s->picture) {
-        av_frame_free(&s->picture);
-        s->picture_ptr = NULL;
-    } else if (s->picture_ptr)
-        av_frame_unref(s->picture_ptr);
+    av_frame_free(&s->picture);
+    s->picture_ptr = NULL;
 
     av_frame_free(&s->smv_frame);
 
diff --git a/libavcodec/mxpegdec.c b/libavcodec/mxpegdec.c
index c5c14cbe79..8661bba566 100644
--- a/libavcodec/mxpegdec.c
+++ b/libavcodec/mxpegdec.c
@@ -47,10 +47,8 @@ typedef struct MXpegDecodeContext {
 static av_cold int mxpeg_decode_end(AVCodecContext *avctx)
 {
     MXpegDecodeContext *s = avctx->priv_data;
-    MJpegDecodeContext *jpg = &s->jpg;
     int i;
 
-    jpg->picture_ptr = NULL;
     ff_mjpeg_decode_end(avctx);
 
     for (i = 0; i < 2; ++i)



More information about the ffmpeg-cvslog mailing list