[vlc-commits] au: fix initialization
Rémi Denis-Courmont
git at videolan.org
Wed Feb 8 21:45:04 CET 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Feb 8 20:33:30 2017 +0200| [38587a1ccf85fbd6b5b3804f523c54ec7ac5e8fc] | committer: Rémi Denis-Courmont
au: fix initialization
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=38587a1ccf85fbd6b5b3804f523c54ec7ac5e8fc
---
modules/demux/au.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/modules/demux/au.c b/modules/demux/au.c
index 6a92b65..f9d2b4f 100644
--- a/modules/demux/au.c
+++ b/modules/demux/au.c
@@ -132,7 +132,10 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
+ p_sys = malloc( sizeof (*p_sys) );
+ if( unlikely(p_sys == NULL) )
+ return VLC_ENOMEM;
+
p_sys->i_time = 0;
p_sys->i_header_size = GetDWBE( &hdr[0] );
@@ -141,11 +144,11 @@ static int Open( vlc_object_t *p_this )
{
#if (SSIZE_MAX <= INT32_MAX)
if( p_sys->i_header_size > SSIZE_MAX )
- return VLC_EGENERIC;
+ goto error;
#endif
size_t skip = p_sys->i_header_size - 24;
if( vlc_stream_Read( p_demux->s, NULL, skip ) < (ssize_t)skip )
- return VLC_EGENERIC;
+ goto error;
}
/* init fmt */
@@ -260,19 +263,14 @@ static int Open( vlc_object_t *p_this )
if( i_cat == AU_CAT_UNKNOWN || i_cat == AU_CAT_ADPCM )
{
- p_sys->i_frame_size = 0;
- p_sys->i_frame_length = 0;
-
msg_Err( p_demux, "unsupported codec/type (Please report it)" );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
if( p_sys->fmt.audio.i_rate == 0 )
{
msg_Err( p_demux, "invalid samplerate: 0" );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
/* add the es */
@@ -294,7 +292,13 @@ static int Open( vlc_object_t *p_this )
(mtime_t)i_samples /
(mtime_t)p_sys->fmt.audio.i_rate;
+ p_demux->p_sys = p_sys;
+ p_demux->pf_demux = Demux;
+ p_demux->pf_control = Control;
return VLC_SUCCESS;
+error:
+ free( p_sys );
+ return VLC_EGENERIC;
}
/*****************************************************************************
More information about the vlc-commits
mailing list