[vlc-commits] mp4: use vlc_alloc() for TREF box
Rémi Denis-Courmont
git at videolan.org
Fri Nov 24 20:54:50 CET 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 24 21:45:41 2017 +0200| [7c25c3d9c062d569abb3db61463c456c27cc78b4] | committer: Rémi Denis-Courmont
mp4: use vlc_alloc() for TREF box
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7c25c3d9c062d569abb3db61463c456c27cc78b4
---
modules/demux/mp4/libmp4.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index ff95bad082..faef40eac0 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3798,16 +3798,19 @@ static void MP4_FreeBox_tref_generic( MP4_Box_t *p_box )
static int MP4_ReadBox_tref_generic( stream_t *p_stream, MP4_Box_t *p_box )
{
+ uint32_t count;
+
MP4_READBOX_ENTER( MP4_Box_data_tref_generic_t, MP4_FreeBox_tref_generic );
p_box->data.p_tref_generic->i_track_ID = NULL;
- p_box->data.p_tref_generic->i_entry_count = i_read / sizeof(uint32_t);
- if( p_box->data.p_tref_generic->i_entry_count > 0 )
- p_box->data.p_tref_generic->i_track_ID = calloc( p_box->data.p_tref_generic->i_entry_count, sizeof(uint32_t) );
+ count = i_read / sizeof(uint32_t);
+ p_box->data.p_tref_generic->i_entry_count = count;
+ p_box->data.p_tref_generic->i_track_ID = vlc_alloc( count,
+ sizeof(uint32_t) );
if( p_box->data.p_tref_generic->i_track_ID == NULL )
MP4_READBOX_EXIT( 0 );
- for( unsigned i = 0; i < p_box->data.p_tref_generic->i_entry_count; i++ )
+ for( unsigned i = 0; i < count; i++ )
{
MP4_GET4BYTES( p_box->data.p_tref_generic->i_track_ID[i] );
}
More information about the vlc-commits
mailing list