]> git.sesse.net Git - vlc/commitdiff
* Fixed a bunch of memory leaks.
authorGildas Bazin <gbazin@videolan.org>
Sat, 7 Oct 2006 23:14:58 +0000 (23:14 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sat, 7 Oct 2006 23:14:58 +0000 (23:14 +0000)
modules/demux/mp4/libmp4.c
modules/demux/playlist/playlist.c
modules/demux/playlist/playlist.h
modules/demux/playlist/xspf.c
modules/misc/xml/libxml.c
src/input/input.c
src/video_output/vout_subpictures.c

index 6c282ead393c51f0299c9742945181ead97f711e..4bb335f1fda2b2a70ab8f25cf912d01576d6c39b 100644 (file)
@@ -957,8 +957,11 @@ static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box )
     p_avcC = p_box->data.p_avcC;
 
     p_avcC->i_avcC = i_read;
-    p_avcC->p_avcC = malloc( p_avcC->i_avcC );
-    memcpy( p_avcC->p_avcC, p_peek, i_read );
+    if( p_avcC->i_avcC > 0 )
+    {
+        p_avcC->p_avcC = malloc( p_avcC->i_avcC );
+        memcpy( p_avcC->p_avcC, p_peek, i_read );
+    }
 
     MP4_GET1BYTE( p_avcC->i_version );
     MP4_GET1BYTE( p_avcC->i_profile );
@@ -1030,6 +1033,8 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
     MP4_Box_data_avcC_t *p_avcC = p_box->data.p_avcC;
     int i;
 
+    if( p_avcC->i_avcC > 0 ) FREENULL( p_avcC->p_avcC );
+
     for( i = 0; i < p_avcC->i_sps; i++ )
     {
         FREENULL( p_avcC->sps[i] );
@@ -1039,7 +1044,9 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
         FREENULL( p_avcC->pps[i] );
     }
     if( p_avcC->i_sps > 0 ) FREENULL( p_avcC->sps );
+    if( p_avcC->i_sps > 0 ) FREENULL( p_avcC->i_sps_length );
     if( p_avcC->i_pps > 0 ) FREENULL( p_avcC->pps );
+    if( p_avcC->i_pps > 0 ) FREENULL( p_avcC->i_pps_length );
 }
 
 static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
index f2acf2ddc418930f1d743046aca41ddce0558ac5..5d991178c946688f5de6d702580d316eb0fe6874 100644 (file)
@@ -85,7 +85,7 @@ vlc_module_begin();
         set_description( _("XSPF playlist import") );
         add_shortcut( "xspf-open" );
         set_capability( "demux2", 10 );
-        set_callbacks( E_(xspf_import_Activate), NULL );
+        set_callbacks( E_(Import_xspf),E_(Close_xspf) );
     add_submodule();
         set_description( _("New winamp 5.2 shoutcast import") );
         add_shortcut( "shout-winamp" );
index 14983004c2a4a2faea2e239dbdb5fef0f32229dd..4e643b85428dcf009a12634b7bf1914c46450f89 100644 (file)
@@ -48,7 +48,8 @@ void E_(Close_DVB) ( vlc_object_t * );
 int E_(Import_podcast) ( vlc_object_t * );
 void E_(Close_podcast) ( vlc_object_t * );
 
-int E_(xspf_import_Activate) ( vlc_object_t * );
+int E_(Import_xspf) ( vlc_object_t * );
+void E_(Close_xspf) ( vlc_object_t * );
 
 int E_(Import_Shoutcast) ( vlc_object_t * );
 void E_(Close_Shoutcast) ( vlc_object_t * );
index 442294bf81fe976a5e6273d45a3a859fed2f8066..9c8a49c31bd0b43c6d2f8b1d875b0a506d7ceeb5 100644 (file)
@@ -51,13 +51,19 @@ static int Demux( demux_t * );
 /**
  * \brief XSPF submodule initialization function
  */
-int E_(xspf_import_Activate)( vlc_object_t *p_this )
+int E_(Import_xspf)( vlc_object_t *p_this )
 {
     DEMUX_BY_EXTENSION_OR_FORCED_MSG( ".xspf", "xspf-open", 
                                       "using XSPF playlist reader" );
     return VLC_SUCCESS;
 }
 
+void E_(Close_xspf)( vlc_object_t *p_this )
+{
+    demux_t *p_demux = (demux_t *)p_this;
+    free( p_demux->p_sys );
+}
+
 /**
  * \brief demuxer function for XSPF parsing
  */
index 4387b1c03ca25a1768fe70aceaa2c64cc38d1ce5..84ef82de2445fed8ede9e40be14e0aae5d5f7be5 100644 (file)
@@ -120,9 +120,6 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *p_stream )
     xml_reader_t *p_reader;
     xml_reader_sys_t *p_sys;
     xmlTextReaderPtr p_libxml_reader;
-    xmlParserInputBufferPtr p_read_context;
-
-    p_read_context = malloc( sizeof( xmlParserInputBuffer ) );
 
     p_libxml_reader = xmlReaderForIO( StreamRead, NULL, p_stream,
                                       NULL, NULL, 0 );
@@ -216,7 +213,7 @@ static char *ReaderName( xml_reader_t *p_reader )
     const xmlChar *psz_name =
         xmlTextReaderConstName( p_reader->p_sys->p_reader );
 
-    if( psz_name ) return strdup( psz_name );
+    if( psz_name ) return strdup( (const char *)psz_name );
     else return 0;
 }
 
@@ -225,7 +222,7 @@ static char *ReaderValue( xml_reader_t *p_reader )
     const xmlChar *psz_value =
         xmlTextReaderConstValue( p_reader->p_sys->p_reader );
 
-    if( psz_value ) return strdup( psz_value );
+    if( psz_value ) return strdup( (const char *)psz_value );
     else return 0;
 }
 
index 6965789770ee5286c741a80f33e4c194deb5c7e7..81c17410fcf76f32651cdec0a047062e98d46b37 100644 (file)
@@ -1970,8 +1970,8 @@ static int InputSourceInit( input_thread_t *p_input,
     {
         psz_path = psz_mrl;
         msg_Dbg( p_input, "trying to pre-parse %s",  psz_path );
-        psz_demux = strdup( "" );
-        psz_access = strdup( "file" );
+        psz_demux = "";
+        psz_access = "file";
     }
 
     if( in->p_demux )
index cb75b68efe7d1bcb16bb6f99d1cdac44a0d7de4b..b43ea11b497356a091d67376ad2356c73cd7ec5e 100644 (file)
@@ -98,7 +98,6 @@ spu_t *__spu_Create( vlc_object_t *p_this )
  */
 int spu_Init( spu_t *p_spu )
 {
-    char *psz_filter;
     char *psz_parser;
     vlc_value_t val;
 
@@ -110,8 +109,7 @@ int spu_Init( spu_t *p_spu )
     var_Create( p_spu, "sub-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
     var_Get( p_spu, "sub-filter", &val );
 
-    psz_filter = val.psz_string;
-    psz_parser = psz_filter;
+    psz_parser = val.psz_string;
 
     while( psz_parser && *psz_parser )
     {
@@ -153,6 +151,7 @@ int spu_Init( spu_t *p_spu )
 
         free( psz_name );
     }
+    if( val.psz_string ) free( val.psz_string );
 
     return VLC_EGENERIC;
 }