From: Gildas Bazin Date: Sat, 7 Feb 2004 00:16:34 +0000 (+0000) Subject: * modules/demux/ogg.c: fixed memleak. X-Git-Tag: 0.7.1~208 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f6fd063a734321a50b6381b5fd20a05280403981;p=vlc * modules/demux/ogg.c: fixed memleak. * modules/codec/flac.c: fixed memleak. * include/vlc_es.h: es_format_Free(). --- diff --git a/include/vlc_es.h b/include/vlc_es.h index 637fe6349b..b42243da97 100644 --- a/include/vlc_es.h +++ b/include/vlc_es.h @@ -2,7 +2,7 @@ * vlc_es.h: Elementary stream formats descriptions ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: vlc_es.h,v 1.8 2004/01/30 15:17:39 fenrir Exp $ + * $Id: vlc_es.h,v 1.9 2004/02/07 00:16:34 gbazin Exp $ * * Authors: Laurent Aimar * @@ -179,8 +179,10 @@ static inline void es_format_Init( es_format_t *fmt, static inline void es_format_Copy( es_format_t *dst, es_format_t *src ) { memcpy( dst, src, sizeof( es_format_t ) ); - if( src->psz_language ) dst->psz_language = strdup( src->psz_language ); - if( src->psz_description ) dst->psz_description = strdup( src->psz_description ); + if( src->psz_language ) + dst->psz_language = strdup( src->psz_language ); + if( src->psz_description ) + dst->psz_description = strdup( src->psz_description ); if( src->i_extra > 0 ) { dst->p_extra = malloc( src->i_extra ); @@ -194,4 +196,12 @@ static inline void es_format_Copy( es_format_t *dst, es_format_t *src ) } } +static inline void es_format_Free( es_format_t *fmt ) +{ + if( fmt->psz_language ) free( fmt->psz_language ); + if( fmt->psz_description ) free( fmt->psz_description ); + if( fmt->i_extra > 0 ) free( fmt->p_extra ); + if( fmt->video.p_palette ) free( fmt->video.p_palette ); +} + #endif diff --git a/modules/codec/flac.c b/modules/codec/flac.c index 8347a9053f..52e34be038 100644 --- a/modules/codec/flac.c +++ b/modules/codec/flac.c @@ -2,7 +2,7 @@ * flac.c: flac decoder/packetizer/encoder module making use of libflac ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: flac.c,v 1.7 2004/01/25 18:20:12 bigben Exp $ + * $Id: flac.c,v 1.8 2004/02/07 00:16:34 gbazin Exp $ * * Authors: Gildas Bazin * Sigmund Augdal @@ -424,6 +424,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) } block_Release( p_sys->p_block ); + p_sys->p_block = NULL; } return p_sys->p_aout_buffer; @@ -439,6 +440,7 @@ static void CloseDecoder( vlc_object_t *p_this ) FLAC__stream_decoder_finish( p_sys->p_flac ); FLAC__stream_decoder_delete( p_sys->p_flac ); + if( p_sys->p_block ) free( p_sys->p_block ); free( p_sys ); } diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c index fa6b25167e..5ee04e685f 100644 --- a/modules/demux/ogg.c +++ b/modules/demux/ogg.c @@ -2,7 +2,7 @@ * ogg.c : ogg stream demux module for vlc ***************************************************************************** * Copyright (C) 2001-2003 VideoLAN - * $Id: ogg.c,v 1.54 2004/02/06 23:43:32 gbazin Exp $ + * $Id: ogg.c,v 1.55 2004/02/07 00:16:34 gbazin Exp $ * * Author: Gildas Bazin * @@ -1111,6 +1111,8 @@ static void Ogg_EndOfStream( input_thread_t *p_input, demux_sys_t *p_ogg ) if( p_ogg->pp_stream[i_stream]->p_packets_backup) free( p_ogg->pp_stream[i_stream]->p_packets_backup ); + es_format_Free( &p_stream->fmt ); + free( p_ogg->pp_stream[i_stream] ); } #undef p_stream