[vlc-commits] [Git][videolan/vlc][master] 2 commits: demux: libmp4: just use calloc for zero'ed allocs
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed May 24 14:09:21 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
55d50eb7 by Francois Cartegnie at 2023-05-24T13:49:04+00:00
demux: libmp4: just use calloc for zero'ed allocs
- - - - -
cdd0f8fb by Francois Cartegnie at 2023-05-24T13:49:04+00:00
demux: libmp4: fix potential leak on sibling array alloc failure
- - - - -
1 changed file:
- modules/demux/mp4/libmp4.c
Changes:
=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -168,11 +168,10 @@ static uint8_t *mp4_readbox_enter_common( stream_t *s, MP4_Box_t *box,
goto error;
}
- box->data.p_payload = malloc( typesize );
+ box->data.p_payload = calloc( 1, typesize );
if( unlikely(box->data.p_payload == NULL) )
goto error;
- memset( box->data.p_payload, 0, typesize );
box->pf_free = release;
return buf;
error:
@@ -1582,6 +1581,7 @@ static int MP4_ReadBox_stts( stream_t *p_stream, MP4_Box_t *p_box )
if( p_box->data.p_stts->pi_sample_count == NULL
|| p_box->data.p_stts->pi_sample_delta == NULL )
{
+ MP4_FreeBox_stts( p_box );
MP4_READBOX_EXIT( 0 );
}
@@ -1626,7 +1626,10 @@ static int MP4_ReadBox_ctts( stream_t *p_stream, MP4_Box_t *p_box )
p_box->data.p_ctts->pi_sample_offset = vlc_alloc( count, sizeof(int32_t) );
if( unlikely(p_box->data.p_ctts->pi_sample_count == NULL
|| p_box->data.p_ctts->pi_sample_offset == NULL) )
+ {
+ MP4_FreeBox_ctts( p_box );
MP4_READBOX_EXIT( 0 );
+ }
p_box->data.p_ctts->i_entry_count = count;
for( uint32_t i = 0; i < count; i++ )
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0830f5c4e1b0cff49553608a3551c4b6513cf69f...cdd0f8fb21276b42b874db49ef9672f4c5fcd8d5
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0830f5c4e1b0cff49553608a3551c4b6513cf69f...cdd0f8fb21276b42b874db49ef9672f4c5fcd8d5
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list