Browse code

avcodec/mpeg4videodec: unbreak multithreading decoding

Should fix double free related crashes.

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

James Almer authored on 2018/04/04 23:06:55
Showing 1 changed files
... ...
@@ -3380,11 +3380,13 @@ static av_cold int decode_end(AVCodecContext *avctx)
3380 3380
     Mpeg4DecContext *ctx = avctx->priv_data;
3381 3381
     int i;
3382 3382
 
3383
-    for (i = 0; i < 12; i++)
3384
-        ff_free_vlc(&ctx->studio_intra_tab[i]);
3383
+    if (!avctx->internal->is_copy) {
3384
+        for (i = 0; i < 12; i++)
3385
+            ff_free_vlc(&ctx->studio_intra_tab[i]);
3385 3386
 
3386
-    ff_free_vlc(&ctx->studio_luma_dc);
3387
-    ff_free_vlc(&ctx->studio_chroma_dc);
3387
+        ff_free_vlc(&ctx->studio_luma_dc);
3388
+        ff_free_vlc(&ctx->studio_chroma_dc);
3389
+    }
3388 3390
 
3389 3391
     return ff_h263_decode_end(avctx);
3390 3392
 }