]> git.sesse.net Git - vlc/commitdiff
* modules/demux/ogg.c: fixed memleak.
authorGildas Bazin <gbazin@videolan.org>
Sat, 7 Feb 2004 00:16:34 +0000 (00:16 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sat, 7 Feb 2004 00:16:34 +0000 (00:16 +0000)
* modules/codec/flac.c: fixed memleak.
* include/vlc_es.h: es_format_Free().

include/vlc_es.h
modules/codec/flac.c
modules/demux/ogg.c

index 637fe6349bdc5b361e4dae89be933a27372e8352..b42243da97fb456150779143f0dd134e79478460 100644 (file)
@@ -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 <fenrir@via.ecp.fr>
  *
@@ -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
index 8347a9053f1ad8169f5370306e92fc4104869c96..52e34be03861c84f36bb915019c54fb5fc0bd68c 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *          Sigmund Augdal <sigmunau@idi.ntnu.no>
@@ -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 );
 }
     
index fa6b25167e5036fe3ac3f1267c9d342fa54dac0f..5ee04e685f9bb4af4d7babd4d740382db7fe233b 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -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