[vlc-commits] demux: avi: fix leak on missing index
Francois Cartegnie
git at videolan.org
Mon Oct 30 13:42:42 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct 30 13:10:09 2017 +0100| [e1be5bcac0cf1f7e461d632a1ae1d7b8b3c9e0fd] | committer: Francois Cartegnie
demux: avi: fix leak on missing index
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e1be5bcac0cf1f7e461d632a1ae1d7b8b3c9e0fd
---
modules/demux/avi/avi.c | 68 ++++++++++++++++++++++---------------------------
1 file changed, 30 insertions(+), 38 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index b58c23237f..da0903f1c1 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -255,6 +255,35 @@ static int AVI_TrackStopFinishedStreams( demux_t *);
*/
/*****************************************************************************
+ * Close: frees unused data
+ *****************************************************************************/
+static void Close ( vlc_object_t * p_this )
+{
+ demux_t * p_demux = (demux_t *)p_this;
+ demux_sys_t *p_sys = p_demux->p_sys ;
+
+ for( unsigned int i = 0; i < p_sys->i_track; i++ )
+ {
+ if( p_sys->track[i] )
+ {
+ es_format_Clean( &p_sys->track[i]->fmt );
+ avi_index_Clean( &p_sys->track[i]->idx );
+ free( p_sys->track[i] );
+ }
+ }
+ free( p_sys->track );
+
+ AVI_ChunkFreeRoot( p_demux->s, &p_sys->ck_root );
+ vlc_meta_Delete( p_sys->meta );
+
+ for( unsigned i = 0; i < p_sys->i_attachment; i++)
+ vlc_input_attachment_Delete(p_sys->attachment[i]);
+ free(p_sys->attachment);
+
+ free( p_sys );
+}
+
+/*****************************************************************************
* Open: check file and initializes AVI structures
*****************************************************************************/
static int Open( vlc_object_t * p_this )
@@ -855,48 +884,11 @@ aviindex:
return VLC_SUCCESS;
error:
- for( unsigned i = 0; i < p_sys->i_attachment; i++)
- vlc_input_attachment_Delete(p_sys->attachment[i]);
- free(p_sys->attachment);
-
- if( p_sys->meta )
- vlc_meta_Delete( p_sys->meta );
-
- AVI_ChunkFreeRoot( p_demux->s, &p_sys->ck_root );
- free( p_sys );
+ Close( p_this );
return b_aborted ? VLC_ETIMEOUT : VLC_EGENERIC;
}
/*****************************************************************************
- * Close: frees unused data
- *****************************************************************************/
-static void Close ( vlc_object_t * p_this )
-{
- demux_t * p_demux = (demux_t *)p_this;
- demux_sys_t *p_sys = p_demux->p_sys ;
-
- for( unsigned int i = 0; i < p_sys->i_track; i++ )
- {
- if( p_sys->track[i] )
- {
- es_format_Clean( &p_sys->track[i]->fmt );
- avi_index_Clean( &p_sys->track[i]->idx );
- free( p_sys->track[i] );
- }
- }
- free( p_sys->track );
-
- AVI_ChunkFreeRoot( p_demux->s, &p_sys->ck_root );
- vlc_meta_Delete( p_sys->meta );
-
- for( unsigned i = 0; i < p_sys->i_attachment; i++)
- vlc_input_attachment_Delete(p_sys->attachment[i]);
- free(p_sys->attachment);
-
- free( p_sys );
-}
-
-/*****************************************************************************
* ReadFrame: Reads frame, using stride if necessary
*****************************************************************************/
More information about the vlc-commits
mailing list