[FFmpeg-cvslog] avcodec/mpeg4videodec: unbreak multithreading decoding

James Almer git at videolan.org
Wed Apr 4 17:09:44 EEST 2018


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Apr  4 11:06:55 2018 -0300| [2f273701119f5ec9534f4327f9f1471728518628] | committer: James Almer

avcodec/mpeg4videodec: unbreak multithreading decoding

Should fix double free related crashes.

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/mpeg4videodec.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 53ad218cb7..32eb3d1ca8 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3380,11 +3380,13 @@ static av_cold int decode_end(AVCodecContext *avctx)
     Mpeg4DecContext *ctx = avctx->priv_data;
     int i;
 
-    for (i = 0; i < 12; i++)
-        ff_free_vlc(&ctx->studio_intra_tab[i]);
+    if (!avctx->internal->is_copy) {
+        for (i = 0; i < 12; i++)
+            ff_free_vlc(&ctx->studio_intra_tab[i]);
 
-    ff_free_vlc(&ctx->studio_luma_dc);
-    ff_free_vlc(&ctx->studio_chroma_dc);
+        ff_free_vlc(&ctx->studio_luma_dc);
+        ff_free_vlc(&ctx->studio_chroma_dc);
+    }
 
     return ff_h263_decode_end(avctx);
 }



More information about the ffmpeg-cvslog mailing list