[vlc-commits] commit: Fixed a few memleaks in AVI demuxer. (Laurent Aimar )
git at videolan.org
git at videolan.org
Thu Apr 15 18:54:43 CEST 2010
vlc/vlc-1.0 | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Apr 15 19:43:43 2010 +0300| [0b800963af8efc21c7653477eb2ae5e4fc5501e3] | committer: Rémi Denis-Courmont
Fixed a few memleaks in AVI demuxer.
(cherry picked from commit 8fe4cd208a50a8a7b2abad17a1eff83e1675fd1f)
Conflicts:
modules/demux/avi/avi.c
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.0.git/?a=commit;h=0b800963af8efc21c7653477eb2ae5e4fc5501e3
---
modules/demux/avi/avi.c | 10 ++++------
modules/demux/avi/libavi.c | 3 ---
modules/demux/avi/libavi.h | 3 +++
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 96add94..e5cd843 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -132,9 +132,6 @@ typedef struct
unsigned int i_idxposc; /* numero of chunk */
unsigned int i_idxposb; /* byte in the current chunk */
- /* extra information given to the decoder */
- void *p_extra;
-
/* For VBR audio only */
unsigned int i_blockno;
unsigned int i_blocksize;
@@ -427,7 +424,7 @@ static int Open( vlc_object_t * p_this )
fmt.i_extra = __MIN( p_auds->p_wf->cbSize,
p_auds->i_chunk_size - sizeof(WAVEFORMATEX) );
- fmt.p_extra = tk->p_extra = malloc( fmt.i_extra );
+ fmt.p_extra = malloc( fmt.i_extra );
if( !fmt.p_extra ) goto error;
memcpy( fmt.p_extra, &p_auds->p_wf[1], fmt.i_extra );
@@ -483,7 +480,7 @@ static int Open( vlc_object_t * p_this )
uint8_t *p_out = malloc( i_headers_size );
if( !p_out ) goto error;
free( fmt.p_extra );
- fmt.p_extra = tk->p_extra = p_out;
+ fmt.p_extra = p_out;
fmt.i_extra = i_headers_size;
#define copy_packet( len ) \
*p_out++ = len >> 8; \
@@ -646,6 +643,7 @@ static int Open( vlc_object_t * p_this )
if( tk->p_out_muxed == NULL )
tk->p_es = es_out_Add( p_demux->out, &fmt );
TAB_APPEND( p_sys->i_track, p_sys->track, tk );
+ es_format_Clean( &fmt );
}
if( p_sys->i_track <= 0 )
@@ -798,7 +796,6 @@ static void Close ( vlc_object_t * p_this )
if( p_sys->track[i]->p_out_muxed )
stream_Delete( p_sys->track[i]->p_out_muxed );
free( p_sys->track[i]->p_index );
- free( p_sys->track[i]->p_extra );
free( p_sys->track[i] );
}
}
@@ -2348,6 +2345,7 @@ static void AVI_IndexLoad_indx( demux_t *p_demux )
break;
}
__Parse_indx( p_demux, i_stream, &ck_sub.indx );
+ AVI_ChunkFree( p_demux->s, &ck_sub );
}
}
else
diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index be897a7..7548333 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -40,9 +40,6 @@ static vlc_fourcc_t GetFOURCC( const uint8_t *p_buff )
return VLC_FOURCC( p_buff[0], p_buff[1], p_buff[2], p_buff[3] );
}
-#define AVI_ChunkFree( a, b ) _AVI_ChunkFree( (a), (avi_chunk_t*)(b) )
-void _AVI_ChunkFree( stream_t *, avi_chunk_t *p_chk );
-
/****************************************************************************
*
* Basics functions to manipulates chunks
diff --git a/modules/demux/avi/libavi.h b/modules/demux/avi/libavi.h
index 453602c..3bdc04c 100644
--- a/modules/demux/avi/libavi.h
+++ b/modules/demux/avi/libavi.h
@@ -216,6 +216,7 @@ typedef union avi_chunk_u
int _AVI_ChunkRead( stream_t *,
avi_chunk_t *p_chk,
avi_chunk_t *p_father );
+void _AVI_ChunkFree( stream_t *, avi_chunk_t * );
int _AVI_ChunkCount( avi_chunk_t *, vlc_fourcc_t );
void *_AVI_ChunkFind ( avi_chunk_t *, vlc_fourcc_t, int );
@@ -229,6 +230,8 @@ void AVI_ChunkFreeRoot( stream_t *, avi_chunk_t *p_chk );
_AVI_ChunkCount( (avi_chunk_t*)p_chk, i_fourcc )
#define AVI_ChunkFind( p_chk, i_fourcc, i_number ) \
_AVI_ChunkFind( (avi_chunk_t*)p_chk, i_fourcc, i_number )
+#define AVI_ChunkFree( a, b ) \
+ _AVI_ChunkFree( (a), (avi_chunk_t*)(b) )
/* *** avi stuff *** */
More information about the vlc-commits
mailing list