[vlc-devel] commit: Fix potential memleak. ( Rémi Duraffort )

git version control git at videolan.org
Fri Aug 15 21:54:40 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Aug 15 09:26:33 2008 +0200| [775254b88b5e8fc2ebee6f375c2da4d8af1b7e7f] | committer: Rémi Duraffort 

Fix potential memleak.

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

 modules/demux/playlist/b4s.c            |    7 ++++++-
 modules/demux/playlist/podcast.c        |    7 ++++++-
 modules/gui/skins2/parser/xmlparser.cpp |    7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/modules/demux/playlist/b4s.c b/modules/demux/playlist/b4s.c
index 8431a06..629137f 100644
--- a/modules/demux/playlist/b4s.c
+++ b/modules/demux/playlist/b4s.c
@@ -149,7 +149,12 @@ static int Demux( demux_t *p_demux )
     {
         char *psz_name = xml_ReaderName( p_xml_reader );
         char *psz_value = xml_ReaderValue( p_xml_reader );
-        if( !psz_name || !psz_value ) return -1;
+        if( !psz_name || !psz_value )
+        {
+            free( psz_name );
+            free( psz_value );
+            return -1;
+        }
         if( !strcmp( psz_name, "num_entries" ) )
         {
             msg_Dbg( p_demux, "playlist has %d entries", atoi(psz_value) );
diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c
index 20f8754..c507cdd 100644
--- a/modules/demux/playlist/podcast.c
+++ b/modules/demux/playlist/podcast.c
@@ -168,7 +168,12 @@ static int Demux( demux_t *p_demux )
                 {
                     char *psz_name = xml_ReaderName( p_xml_reader );
                     char *psz_value = xml_ReaderValue( p_xml_reader );
-                    if( !psz_name || !psz_value ) return -1;
+                    if( !psz_name || !psz_value )
+                    {
+                        free( psz_name );
+                        free( psz_value );
+                        return -1;
+                    }
                     if( !strcmp( psz_elname, "enclosure" ) &&
                         !strcmp( psz_name, "url" ) )
                     {
diff --git a/modules/gui/skins2/parser/xmlparser.cpp b/modules/gui/skins2/parser/xmlparser.cpp
index 2e66d04..793affb 100644
--- a/modules/gui/skins2/parser/xmlparser.cpp
+++ b/modules/gui/skins2/parser/xmlparser.cpp
@@ -163,7 +163,12 @@ bool XMLParser::parse()
                 {
                     char *name = xml_ReaderName( m_pReader );
                     char *value = xml_ReaderValue( m_pReader );
-                    if( !name || !value ) return false;
+                    if( !name || !value )
+                    {
+                        free( name );
+                        free( value );
+                        return false;
+                    }
                     attributes[name] = value;
                 }
 




More information about the vlc-devel mailing list