[vlc-commits] [Git][videolan/vlc][master] demux: libmp4: replace malloc with vlc_alloc
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Apr 9 19:02:11 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
67162edf by François Cartegnie at 2026-04-09T18:33:09+00:00
demux: libmp4: replace malloc with vlc_alloc
- - - - -
1 changed file:
- modules/demux/mp4/libmp4.c
Changes:
=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -4570,8 +4570,7 @@ static int MP4_ReadBox_Reference( stream_t *p_stream, MP4_Box_t *p_box )
p_data->i_reference_count )
MP4_READBOX_EXIT( 0 );
- p_data->p_references = malloc( sizeof(*p_data->p_references) *
- p_data->i_reference_count );
+ p_data->p_references = vlc_alloc( p_data->i_reference_count, sizeof(*p_data->p_references) );
if( !p_data->p_references )
MP4_READBOX_EXIT( 0 );
for( uint16_t i=0; i<p_data->i_reference_count; i++ )
@@ -4669,7 +4668,7 @@ static int MP4_ReadBox_iloc( stream_t *p_stream, MP4_Box_t *p_box )
if( i_read / 6 < p_data->i_item_count )
MP4_READBOX_EXIT( 0 );
- p_data->p_items = malloc( p_data->i_item_count * sizeof(p_data->p_items[0]) );
+ p_data->p_items = vlc_alloc( p_data->i_item_count, sizeof(p_data->p_items[0]) );
if( !p_data->p_items )
MP4_READBOX_EXIT( 0 );
@@ -4712,7 +4711,7 @@ static int MP4_ReadBox_iloc( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 0 );
}
- p_data->p_items[i].p_extents = malloc( p_data->p_items[i].i_extent_count *
+ p_data->p_items[i].p_extents = vlc_alloc( p_data->p_items[i].i_extent_count,
sizeof(p_data->p_items[i].p_extents[0]) );
if(!p_data->p_items[i].p_extents)
{
@@ -4915,7 +4914,7 @@ static int MP4_ReadBox_ipma( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 0 );
}
- p_data->p_entries = malloc( sizeof(p_data->p_entries[0]) * p_data->i_entry_count );
+ p_data->p_entries = vlc_alloc( p_data->i_entry_count, sizeof(p_data->p_entries[0]) );
if( !p_data->p_entries )
{
p_data->i_entry_count = 0;
@@ -4943,8 +4942,8 @@ static int MP4_ReadBox_ipma( stream_t *p_stream, MP4_Box_t *p_box )
}
p_data->p_entries[i].p_assocs =
- malloc( sizeof(p_data->p_entries[i].p_assocs[0]) *
- p_data->p_entries[i].i_association_count );
+ vlc_alloc( p_data->p_entries[i].i_association_count,
+ sizeof(p_data->p_entries[i].p_assocs[0]) );
if( !p_data->p_entries[i].p_assocs )
{
p_data->p_entries[i].i_association_count = 0;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/67162edf95398339290b0995b7e59cc4ee7ce6c6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/67162edf95398339290b0995b7e59cc4ee7ce6c6
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list