]> git.sesse.net Git - vlc/commitdiff
* subtitle: fixed a small memleak.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 18 Jul 2004 17:04:44 +0000 (17:04 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 18 Jul 2004 17:04:44 +0000 (17:04 +0000)
modules/demux/subtitle.c

index 0809859476b866b5752344e36c45edb2ae29994c..20572f5e4243444674664e2475d160e41ce3dffd 100644 (file)
@@ -232,7 +232,7 @@ static int Open ( vlc_object_t *p_this )
     if( p_sys->i_type == SUB_TYPE_UNKNOWN )
     {
         int     i_try;
-        char    *s;
+        char    *s = NULL;
 
         msg_Dbg( p_demux, "autodetecting subtitle format" );
         for( i_try = 0; i_try < 256; i_try++ )
@@ -301,8 +301,13 @@ static int Open ( vlc_object_t *p_this )
                 p_sys->i_type = SUB_TYPE_VOBSUB;
                 break;
             }
+
+            free( s );
+            s = NULL;
         }
 
+        if( s ) free( s );
+
         /* It will nearly always work even for non seekable stream thanks the
          * caching system, and if it fails we loose just a few sub */
         if( stream_Seek( p_demux->s, 0 ) )
@@ -464,6 +469,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             {
                 p_sys->i_subtitle++;
             }
+
             if( p_sys->i_subtitle >= p_sys->i_subtitles )
                 return VLC_EGENERIC;
             return VLC_SUCCESS;