[vlc-commits] mux: libmp4: use vlc_realloc_array
Francois Cartegnie
git at videolan.org
Wed Oct 23 13:20:56 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct 21 12:11:07 2019 +0200| [0dc6112834117a7b4d3b6c86177d44d231a63b9f] | committer: Francois Cartegnie
mux: libmp4: use vlc_realloc_array
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0dc6112834117a7b4d3b6c86177d44d231a63b9f
---
modules/mux/mp4/libmp4mux.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/mux/mp4/libmp4mux.c b/modules/mux/mp4/libmp4mux.c
index 843c320698..86df78bd82 100644
--- a/modules/mux/mp4/libmp4mux.c
+++ b/modules/mux/mp4/libmp4mux.c
@@ -158,8 +158,11 @@ mp4mux_trackinfo_t * mp4mux_track_Add(mp4mux_handle_t *h, unsigned id,
bool mp4mux_track_AddEdit(mp4mux_trackinfo_t *t, const mp4mux_edit_t *p_newedit)
{
- mp4mux_edit_t *p_realloc = realloc( t->p_edits, sizeof(mp4mux_edit_t) *
- (t->i_edits_count + 1) );
+ if(t->i_edits_count + 1 < t->i_edits_count)
+ return false;
+ mp4mux_edit_t *p_realloc = vlc_reallocarray( t->p_edits,
+ t->i_edits_count + 1,
+ sizeof(*p_realloc) );
if(unlikely(!p_realloc))
return false;
More information about the vlc-commits
mailing list