[vlc-devel] commit: Avoid a malloc(0) ( Rémi Duraffort )
git version control
git at videolan.org
Wed Sep 24 22:40:08 CEST 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Sep 17 22:00:52 2008 +0200| [4fa0611dd2ce05655d8e3be69452290e7b28cf51] | committer: Rémi Duraffort
Avoid a malloc(0)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4fa0611dd2ce05655d8e3be69452290e7b28cf51
---
modules/demux/mp4/mp4.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index ebe914d..5ad7349 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1688,9 +1688,12 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
if( p_avcC )
{
p_track->fmt.i_extra = p_avcC->data.p_avcC->i_avcC;
- p_track->fmt.p_extra = malloc( p_avcC->data.p_avcC->i_avcC );
- memcpy( p_track->fmt.p_extra, p_avcC->data.p_avcC->p_avcC,
- p_track->fmt.i_extra );
+ if( p_track->fmt.i_extra > 0 )
+ {
+ p_track->fmt.p_extra = malloc( p_avcC->data.p_avcC->i_avcC );
+ memcpy( p_track->fmt.p_extra, p_avcC->data.p_avcC->p_avcC,
+ p_track->fmt.i_extra );
+ }
}
else
{
More information about the vlc-devel
mailing list