[vlc-commits] avcodec: encoder: fix MPEG4 matrix passed as const
Steve Lhomme
git at videolan.org
Mon Jul 15 09:22:35 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 10 08:23:45 2019 +0200| [d86c4c87aa78130a4fd00294e25df865d0e2b327] | committer: Steve Lhomme
avcodec: encoder: fix MPEG4 matrix passed as const
lavc expects a pointer that it will free in avcodec_free_context().
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d86c4c87aa78130a4fd00294e25df865d0e2b327
---
modules/codec/avcodec/encoder.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index cbac0d3394..2564e0a518 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -580,8 +580,14 @@ int InitVideoEnc( vlc_object_t *p_this )
if ( p_sys->b_mpeg4_matrix )
{
- p_context->intra_matrix = mpeg4_default_intra_matrix;
- p_context->inter_matrix = mpeg4_default_non_intra_matrix;
+ p_context->intra_matrix = av_malloc( sizeof(mpeg4_default_intra_matrix) );
+ if ( p_context->intra_matrix )
+ memcpy( p_context->intra_matrix, mpeg4_default_intra_matrix,
+ sizeof(mpeg4_default_intra_matrix));
+ p_context->inter_matrix = av_malloc( sizeof(mpeg4_default_non_intra_matrix) );
+ if ( p_context->inter_matrix )
+ memcpy( p_context->inter_matrix, mpeg4_default_non_intra_matrix,
+ sizeof(mpeg4_default_non_intra_matrix));
}
if ( p_sys->b_pre_me )
More information about the vlc-commits
mailing list