[vlc-devel] commit: Fix memleaks (CID 211) ( Rémi Duraffort )

git version control git at videolan.org
Thu Oct 2 21:13:32 CEST 2008


vlc | branch: 0.9-bugfix | Rémi Duraffort <ivoire at videolan.org> | Wed Oct  1 21:17:48 2008 +0200| [a9ec7097afd7fd6f99397335660183b9d56c06bc] | committer: Derk-Jan Hartman 

Fix memleaks (CID 211)
(cherry picked from commit 6c79686bfe98e4731aac1118df7004182c20ab45)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a9ec7097afd7fd6f99397335660183b9d56c06bc
---

 modules/demux/subtitle.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 8d86317..5374513 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1459,7 +1459,10 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
 
         const char *s = TextGetLine( txt );
         if( !s )
+        {
+            free( psz_text );
             return VLC_EGENERIC;
+        }
 
         if( strstr( s, "FORMAT" ) )
         {
@@ -1471,7 +1474,10 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
 
             psz_temp = malloc( strlen(s) );
             if( !psz_temp )
+            {
+                free( psz_text );
                 return VLC_ENOMEM;
+            }
 
             if( sscanf( s, "FORMAT=%[^\r\n]", psz_temp ) )
             {
@@ -1504,7 +1510,10 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
         const char *s = TextGetLine( txt );
 
         if( !s )
+        {
+            free( psz_text );
             return VLC_EGENERIC;
+        }
 
         int i_len = strlen( s );
         if( i_len == 0 )




More information about the vlc-devel mailing list