]> git.sesse.net Git - vlc/commitdiff
Fixed a memory leak in the ifo parser and input_EndStream
authorJon Lech Johansen <jlj@videolan.org>
Thu, 9 Aug 2001 20:16:17 +0000 (20:16 +0000)
committerJon Lech Johansen <jlj@videolan.org>
Thu, 9 Aug 2001 20:16:17 +0000 (20:16 +0000)
plugins/dvd/dvd_ifo.c
plugins/dvd/dvd_netlist.c
plugins/dvd/input_dvd.c
src/input/input_programs.c

index 3a02db5d2cc1adbeef34239e5c8e89d9ec9e6bac..44db22113d963a5117eeb443ed24fe4f5323763a 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_ifo.c: Functions for ifo parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_ifo.c,v 1.36 2001/08/06 13:28:00 sam Exp $
+ * $Id: dvd_ifo.c,v 1.37 2001/08/09 20:16:17 jlj Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          German Tischler <tanis@gaspode.franken.de>
@@ -1145,21 +1145,21 @@ static int FreeTitle( title_t * p_title )
         {
             free( p_title->command.p_cell_command );
         }
+    }
 
-        if( p_title->i_chapter_map_start_byte )
-        {
-            free( p_title->chapter_map.pi_start_cell );
-        }
+    if( p_title->i_chapter_map_start_byte )
+    {
+        free( p_title->chapter_map.pi_start_cell );
+    }
 
-        if( p_title->i_cell_play_start_byte )
-        {
-            free( p_title->p_cell_play );
-        }
+    if( p_title->i_cell_play_start_byte )
+    {
+        free( p_title->p_cell_play );
+    }
 
-        if( p_title->i_cell_pos_start_byte )
-        {
-            free( p_title->p_cell_pos );
-        }
+    if( p_title->i_cell_pos_start_byte )
+    {
+        free( p_title->p_cell_pos );
     }
 
     return 0;
@@ -1221,8 +1221,15 @@ static int ReadUnitInf( ifo_t * p_ifo, unit_inf_t * p_unit_inf,
  *****************************************************************************/ 
 static int FreeUnitInf( unit_inf_t * p_unit_inf )
 {
+    int i;
+    
     if( p_unit_inf->p_title != NULL )
     {
+        for( i = 0 ; i < p_unit_inf->i_title_nb ; i++ )
+        {
+            FreeTitle( &p_unit_inf->p_title[i].title );
+        }
+            
         free( p_unit_inf->p_title );
     }
 
index b426096b8462d0153daf1210f5e13ee1ed71718b..578959891183ab0ee7656045ea04d9b461c52662 100644 (file)
@@ -7,7 +7,7 @@
  * will only be given back to netlist when refcount is zero.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
- * $Id: dvd_netlist.c,v 1.13 2001/07/30 00:53:05 sam Exp $
+ * $Id: dvd_netlist.c,v 1.14 2001/08/09 20:16:17 jlj Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *          Stéphane Borel <stef@videolan.org>
@@ -585,9 +585,10 @@ void DVDNetlistEnd( dvd_netlist_t * p_netlist )
     vlc_mutex_destroy( &p_netlist->lock );
     
     /* free the FIFO, the buffer, and the netlist structure */
-    free( p_netlist->pp_free_data );
-    free( p_netlist->pp_free_pes );
     free( p_netlist->pi_refcount );
+    free( p_netlist->p_free_iovec );
+    free( p_netlist->pp_free_pes );
+    free( p_netlist->pp_free_data );
     free( p_netlist->p_pes );
     free( p_netlist->p_data );
     free( p_netlist->p_buffers );
index 8757b6b71f8463b7cf7a0ba5a00ee96b2197523d..bbbe4d63c24fdcbc1f0ef4d576c28c5ec7609ede 100644 (file)
@@ -10,7 +10,7 @@
  *  -dvd_udf to find files
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.84 2001/08/06 13:28:00 sam Exp $
+ * $Id: input_dvd.c,v 1.85 2001/08/09 20:16:17 jlj Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -514,6 +514,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
                 input_UnselectES( p_input, p_input->stream.pp_selected_es[i] );
             }
 
+            free( p_input->stream.pp_selected_es );
             input_DelProgram( p_input, p_input->stream.pp_programs[0] );
 
             p_input->stream.pp_selected_es = NULL;
index 2f994048fff71baac3b2023c602d876bcae433b5..56eb1930b17fce8e17d5c0b630541a629b60083f 100644 (file)
@@ -2,7 +2,7 @@
  * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_programs.c,v 1.60 2001/07/17 09:48:08 massiot Exp $
+ * $Id: input_programs.c,v 1.61 2001/08/09 20:16:17 jlj Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -104,6 +104,12 @@ void input_EndStream( input_thread_t * p_input )
         input_DelArea( p_input, p_input->stream.pp_areas[0] );
     }
 
+    /* Free selected ES */
+    if( p_input->stream.pp_selected_es != NULL )
+    {
+        free( p_input->stream.pp_selected_es );
+    }
+    
     if( p_input->stream.p_demux_data != NULL )
     {
         free( p_input->stream.p_demux_data );