Commit bb3d29ee authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Memory leak

parent ff8e2f89
...@@ -105,8 +105,8 @@ static int Open( vlc_object_t * p_this ) ...@@ -105,8 +105,8 @@ static int Open( vlc_object_t * p_this )
unsigned int i_size, i_extended; unsigned int i_size, i_extended;
const char *psz_name; const char *psz_name;
WAVEFORMATEXTENSIBLE *p_wf_ext; WAVEFORMATEXTENSIBLE *p_wf_ext = NULL;
WAVEFORMATEX *p_wf; WAVEFORMATEX *p_wf = NULL;
/* Is it a wav file ? */ /* Is it a wav file ? */
if( stream_Peek( p_demux->s, &p_peek, 12 ) < 12 ) return VLC_EGENERIC; if( stream_Peek( p_demux->s, &p_peek, 12 ) < 12 ) return VLC_EGENERIC;
...@@ -119,6 +119,9 @@ static int Open( vlc_object_t * p_this ) ...@@ -119,6 +119,9 @@ static int Open( vlc_object_t * p_this )
p_demux->pf_demux = Demux; p_demux->pf_demux = Demux;
p_demux->pf_control = Control; p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
if( p_sys == NULL )
return VLC_ENOMEM;
p_sys->p_es = NULL; p_sys->p_es = NULL;
p_sys->b_chan_reorder = 0; p_sys->b_chan_reorder = 0;
p_sys->i_channel_mask = 0; p_sys->i_channel_mask = 0;
...@@ -141,6 +144,9 @@ static int Open( vlc_object_t * p_this ) ...@@ -141,6 +144,9 @@ static int Open( vlc_object_t * p_this )
/* load waveformatex */ /* load waveformatex */
p_wf_ext = malloc( __EVEN( i_size ) + 2 ); p_wf_ext = malloc( __EVEN( i_size ) + 2 );
if( p_wf_ext == NULL )
goto error;
p_wf = (WAVEFORMATEX *)p_wf_ext; p_wf = (WAVEFORMATEX *)p_wf_ext;
p_wf->cbSize = 0; p_wf->cbSize = 0;
if( stream_Read( p_demux->s, if( stream_Read( p_demux->s,
...@@ -223,6 +229,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -223,6 +229,7 @@ static int Open( vlc_object_t * p_this )
p_sys->fmt.audio.i_bitspersample, p_sys->fmt.i_extra ); p_sys->fmt.audio.i_bitspersample, p_sys->fmt.i_extra );
free( p_wf ); free( p_wf );
p_wf = NULL;
switch( p_sys->fmt.i_codec ) switch( p_sys->fmt.i_codec )
{ {
...@@ -283,6 +290,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -283,6 +290,7 @@ static int Open( vlc_object_t * p_this )
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
free( p_wf );
relay: relay:
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment