Commit 165f0b11 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

flac: fix leaks on error

parent d144f174
...@@ -136,6 +136,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -136,6 +136,7 @@ static int Open( vlc_object_t * p_this )
p_demux->pf_control = Control; p_demux->pf_control = Control;
p_demux->p_sys = p_sys; p_demux->p_sys = p_sys;
p_sys->b_start = true; p_sys->b_start = true;
p_sys->p_packetizer = NULL;
p_sys->p_meta = NULL; p_sys->p_meta = NULL;
p_sys->i_length = 0; p_sys->i_length = 0;
p_sys->i_pts = 0; p_sys->i_pts = 0;
...@@ -148,10 +149,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -148,10 +149,7 @@ static int Open( vlc_object_t * p_this )
/* We need to read and store the STREAMINFO metadata */ /* We need to read and store the STREAMINFO metadata */
if( ReadMeta( p_demux, &p_streaminfo, &i_streaminfo ) ) if( ReadMeta( p_demux, &p_streaminfo, &i_streaminfo ) )
{ goto error;
free( p_sys );
return VLC_EGENERIC;
}
/* Load the FLAC packetizer */ /* Load the FLAC packetizer */
/* Store STREAMINFO for the decoder and packetizer */ /* Store STREAMINFO for the decoder and packetizer */
...@@ -161,10 +159,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -161,10 +159,7 @@ static int Open( vlc_object_t * p_this )
p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "flac" ); p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "flac" );
if( !p_sys->p_packetizer ) if( !p_sys->p_packetizer )
{ goto error;
free( p_sys );
return VLC_EGENERIC;
}
if( p_sys->i_cover_idx < p_sys->i_attachments ) if( p_sys->i_cover_idx < p_sys->i_attachments )
{ {
...@@ -176,6 +171,9 @@ static int Open( vlc_object_t * p_this ) ...@@ -176,6 +171,9 @@ static int Open( vlc_object_t * p_this )
vlc_meta_Set( p_sys->p_meta, vlc_meta_ArtworkURL, psz_url ); vlc_meta_Set( p_sys->p_meta, vlc_meta_ArtworkURL, psz_url );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
error:
Close( p_this );
return VLC_EGENERIC;
} }
/***************************************************************************** /*****************************************************************************
...@@ -199,7 +197,8 @@ static void Close( vlc_object_t * p_this ) ...@@ -199,7 +197,8 @@ static void Close( vlc_object_t * p_this )
TAB_CLEAN( p_sys->i_title_seekpoints, p_sys->pp_title_seekpoints ); TAB_CLEAN( p_sys->i_title_seekpoints, p_sys->pp_title_seekpoints );
/* Delete the decoder */ /* Delete the decoder */
demux_PacketizerDestroy( p_sys->p_packetizer ); if( p_sys->p_packetizer )
demux_PacketizerDestroy( p_sys->p_packetizer );
if( p_sys->p_meta ) if( p_sys->p_meta )
vlc_meta_Delete( p_sys->p_meta ); vlc_meta_Delete( p_sys->p_meta );
......
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