summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg4videodec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-04-04 11:06:55 -0300
committerJames Almer <jamrial@gmail.com>2018-04-04 11:09:11 -0300
commit2f273701119f5ec9534f4327f9f1471728518628 (patch)
treee044f70b411879c7c4e8f17e4afc1710e124e598 /libavcodec/mpeg4videodec.c
parent2f0e0deadc4ead545c9042ed4c19211a2daa235a (diff)
avcodec/mpeg4videodec: unbreak multithreading decoding
Should fix double free related crashes. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/mpeg4videodec.c')
-rw-r--r--libavcodec/mpeg4videodec.c10
1 files 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);
}